I have this loop that does not mention a list, yet after it is done the list is missing one of its items.
print(numlist)
testlist=numlist
print(testlist)
for i in range(5):
print(numlist)
list1=[]
for numbers in testlist:
list1.append(numbers[i])
print(str(numlist)+'before')
for numbers in testlist: #NUMLIST IS LOSING SOMETHING HERE
if max(list1)>numbers[i]:
testlist.remove(numbers)
print(str(numlist)+'after')
which outputs
[[13, 13, 13, 2, 2], [13, 13, 13, 3, 3]]before
[[13, 13, 13, 3, 3]]after