Skip to main content

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)
 

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

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

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)
 

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

 

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

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)

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

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)

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

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)

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

se añadieron 165 caracteres en el cuerpo
Origen Enlace
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)

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

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)
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)

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

se añadieron 28 caracteres en el cuerpo
Origen Enlace
sioesi
  • 11.5k
  • 7
  • 26
  • 57
Loading
Origen Enlace
Loading