I am gonna print numbers less than 5, but the answer is not what I mean? how should I solve the problem?
a= [1,2,3,4,5,6,7,8,9]
for b in a:
if b>=5:
a.remove(b)
print(a)
answer:
[1, 2, 3, 4, 6, 8]
I am gonna print numbers less than 5, but the answer is not what I mean? how should I solve the problem?
a= [1,2,3,4,5,6,7,8,9]
for b in a:
if b>=5:
a.remove(b)
print(a)
answer:
[1, 2, 3, 4, 6, 8]