clear() – delete all entries in list

Code Explanation

LineDescription
1Declaration and initialization of the list myList with the values 1, 2, 3, 4 and 5
2The clear() method deletes all elements from the list
4print empty list
myList = [1, 2, 3, 4, 5]
myList.clear()

print(myList)
Output
[]