remove third item of a list python code example
Example 1: python how to remove elements from a list
my_list.remove(element)
animals = ['cat', 'dog', 'rabbit', 'guinea pig', 'rabbit']
animals.remove('rabbit')
print(animals)
--> ['cat', 'dog', 'guinea pig', 'rabbit']
animals = list(set['cat', 'dog', 'rabbit', 'guinea pig', 'rabbit']))
animals.remove('rabbit')
print(animals)
--> ['cat', 'dog', 'guinea pig']
Example 2: get an item out of a list python
things = ["apple", "book", 3, ["another list", 85], "orange"]
last = things.pop()
print(last)