Why the output is not an empty list in python

39 views Asked by At
list1=[1,2,3,4,5]
for i in list1:
    list1.remove(i)
print(list1)

why the output is [2,4] why not empty list as the value of I will be list elements

0

There are 0 answers