Source Code:
(back to article)
original_list = [1, 2, 3, 4, 5] for i in range(len(original_list) - 1, -1, -1): if original_list[i] % 2 != 0: original_list.pop(i) print(original_list) # [2, 4]
Result:
Report an issue