I am new to python and i was just writing a programm to get an input like :
1 2 3 4 5 6 7 8 9
I wanted to remove the integers which are bigger than 2 and this was my code:
a = input()
b =a.split()
for i in range(len(b)):
b[i] = int(b[i])
for i in b:
if i >=3:
b.remove(i)
print(b)
I expected an output like this :
[1,2]
but when I run it,it shows this :
[1, 2, 4, 6, 8]
Can someone tell me ,where I made mistake?