It appears that when I want to remove an item from a list, the order gets shuffled. I currently have the following code:
todo = []
for case in cases:
todo.append(case)
for case in todo:
print(case[1]) #first print
while(len(todo) > 0):
for case in todo:
subject = case[1]
print("Case: " + str(subject)) #second print
todo.remove(case)
This gives the following result (first print):
55566
66977
66977
136566
136566
37493
37493
37493
63126
37289
And then the second print (in a different order):
Case: 55566
Case: 66977
Case: 136566
Case: 37493
Case: 63126
Case: 66977
Case: 37493
Case: 37289
Case: 136566
Case: 37493
Does remove imply sorting? And if so, how to maintain the order?