Sobes.tech
Junior — Senior

What result will the program output when deleting list elements during its traversal?

livecode

Task condition

What output will appear in the console after executing the following code? The example demonstrates removing elements from a list while iterating over it.

numbers = [1, 2, 5, 11, 3, 111, 7, 27]
for i in numbers:
    if i < 5:
        numbers.remove(i)
print(numbers)
What result will the program output when deleting… - sobes.tech