I have simple list and I want to remove all elements one by one. Here is the simplified version:
lst=[2,5]
for i in lst:
print(i)
lst.remove(i)
It only remove 2 but element 5 remain. I know the reason as it has been answered in cannot remove the last element of a python list and in Python remove element in list. I also know it might be a bad practice. However both Q/A did not offer the alternative solution what is the good practice to solve this problem. Any help?