List: delete an element : List Remove « List « Python






List: delete an element

List: delete an element

inventory = ["sword", "armor", "shield", "healing potion"]


print "In a great battle, your shield is destroyed."
del inventory[2]
print "Your inventory is now:"
print inventory

           
       








Related examples in the same category

1.List Delete: delete one item and delete an entire sectionList Delete: delete one item and delete an entire section
2.Deleting List ElementsDeleting List Elements
3.List: delete a slice :2List: delete a slice :2
4.Delete an element from a listDelete an element from a list