In this article, we will be covering Lists in Python.
In Python, deleting an item from list is quite easy as syntax. In earlier article we had covered lists. Lets look at how to remove an item from list now. In order to delete an item from list, following syntax is used:
# course 9: Deleting an item from List in Python
var = ["x","y","z"]
del var[2]
Output of above delete an item from list in Python:
In above Python example, we first declared a list and before we print them, we removed the item from that array and tried to print out all items. As output indicates, printing second item did not work. Because the list has not 3 item in it anymore.