Skip to main content

Porque no puedo eliminar un objeto de una lista en python?

Presento mi código:

numbers = list(range(0, 30, 2))
for i in range(0, 30):
    if numbers[i] % 2 == 0 and numbers[i] == 2:
        numbers[i] = 2 
    if numbers[i] % 2 == 0:
        numbers.remove(i)
print(numbers)

Error:

Traceback (most recent call last):
  File "F:/python/list.", line 7, in <module>
    numbers.remove(i)
ValueError: list.remove(x): x not in list