delete all items in list python code example
Example 1: delete all elements in list python
mylist = [1, 2, 3, 4]
mylist.clear()
print(mylist)
# []
Example 2: delete a value in list python
list.remove(element)
Example 3: python list remove all elements
l = [1,2,3,4]
l.clear()
Example 4: how to remove a element from list in python and print it
pop(n) removes the element at the given index number and can print it