Forem

Cristian Fernando
Cristian Fernando

Posted on • Edited on

Ibuprofeno.py💊| #36: Explica este código Python

Explica este código Python

Dificultad: Básico

## Reto #36
lista = [1,2,3]
lista[10] = 0
print(lista) # 🤔
Enter fullscreen mode Exit fullscreen mode
  • A. [1, 2, 3, 0]
  • B. [1, 2, 3, "", "", "", "", "", "", "", 0]
  • C. [1, 2, 3]
  • D. IndexError

Respuesta en el primer comentario.

Top comments (1)

Collapse
 
duxtech profile image
Cristian Fernando

Respuesta:

  • D. IndexError

En Python no es posible asignarle un valor a un index que no existe en una lista, esto automáticamente provocara un IndexError.

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay