Program - The consequences of modifying a list when looping through it
Topic: Program - The consequences of modifying a list when looping through it
Solution
a = [1, 2, 3, 4, 5] for i in a: if not i % 2: a.remove(i) print(a) b = [2, 4, 5, 6] for i in b: if not i % 2: b.remove(i) print(b)
List all Python Programs