Junior — Senior
Code behavior when deleting list items during traversal
livecode
Task condition
Describe what happens in this code fragment, predict its output, and explain what task the author intended to solve. Example: removing elements from a list during iteration.
values = [1, 2, 5, 11, 3, 111, 7, 27]
for x in values:
if x < 5:
values.remove(x)
print(values)