Why does the break
statement return a differrent result?:
Input 1:
list1 = [1,2,3,4]
for i in range(len(list1)):
for i in list1:
list1.remove(i)
print(i, list1)
#break
Output 1:
(1, [2, 3, 4])
(3, [2, 4])
(2, [4])
(4, [])
Input 2:
for i in range(len(list1)):
for i in list1:
list1.remove(i)
print(i, list1)
break
Output 2:
(1, [2, 3, 4])
(2, [3, 4])
(3, [4])
(4, [])