List: delete a slice :2 : List Remove « List « Python






List: delete a slice :2

List: delete a slice :2
inventory = ["sword", "armor", "shield", "healing potion"]

del inventory[:2]

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 an elementList: delete an element
4.Delete an element from a listDelete an element from a list