Remove All Elements From a List in Python
To remove all elements from the list, we use the clear
method. We pass nothing to its parameter:
lst = [1, 2, 3]
lst.clear()
print(lst) # []
Given a list:
lst = ['a', 'b', 'c', 'd', 'e']
Clean it up.
The lists are given:
lst1 = [1, 2, 3]
lst2 = [4, 5, 6]
Combine them and output the result to the console. Then remove all elements from the second list.