Junior — Senior
Removing list items while iterating over it
livecode
Task condition
Analyze what happens in the given code snippet when elements are removed from the list during iteration with a for loop.
nums = [1, 2, 5, 11, 3, 111, 7, 27]
for val in nums:
if val < 5:
nums.remove(val)
print(nums)