0

why doesnt it work:

x = [1, 2, 3, 4, 5, 6, 7, 8]
for w in x:
    if w < 4:
        x.remove(w)
print(x)

output : [2, 4, 5, 6, 7, 8], what I expected: [4, 5, 6, 7, 8]

xardas
  • 3
  • 1

0 Answers0