I wanted to make a program that deletes all the values less than 3 from a list
now ive created a list and want to delete all the numbers less than 3 from that list. and this is the program ive made to achieve it:
somelist=[1,3,5,3,65,67,4,3,2,2,4,56,6,4,3,4,5,4,8]
for x in somelist:
if x<3:
somelist.remove(x)
print(x)
The output i got is:
1
5
3
65
67
4
3
2
4
56
6
4
3
4
5
4
8
It contains 1 & 2.. How's that possible?