I have a list containing the numbers from 1-10.
list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
I now want to remove all numbers smaller than 5.
for i in list:
if i < 5:
list.remove(i)
If i now print the list,
print list
I get this:
[2, 4, 5, 6, 7, 8, 9, 10]
which seems very odd to me. I may be missing something or just overlooking a simple mistake, but I don't see it.
Thanks for your help