I want to remove multiples of 2 from a list. How do I do it?
a = list(range(1, 11))
print(a)
for ele in a:
if ele % 2 == 0:
a.pop(ele)
print(a)
Before the condition, a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
After the condition, I am expecting a = [1, 3, 5, 7, 9]
But I get this error IndexError: pop index out of range
How do I get the indexes of the various multiples of 2 to pop them out?? I am a beginner.