how to remove all ocurrences of an element from a list code example
Example 1: delete all elements in list python
mylist = [1, 2, 3, 4]
mylist.clear()
print(mylist)
# []
Example 2: python list remove all elements
l = [1,2,3,4]
l.clear()
mylist = [1, 2, 3, 4]
mylist.clear()
print(mylist)
# []
l = [1,2,3,4]
l.clear()