Forem

Cristian Fernando
Cristian Fernando

Posted on • Edited on

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

Explica este código Python

Dificultad: Básico

## Reto #46
lista_compras = ["huevos", "pan"]
print(lista_compras * int(3.5))
Enter fullscreen mode Exit fullscreen mode

👉 A. ['huevos', 'pan', 'huevos', 'pan', 'huevos', 'pan']
👉 B. ['huevos', 'pan', 'huevos', 'pan']
👉 C. ["huevos", "pan"]
👉 D. TypeError


Respuesta en el primer comentario.

Top comments (1)

Collapse
 
duxtech profile image
Cristian Fernando • Edited

Respuesta:
👉 A. ['huevos', 'pan', 'huevos', 'pan', 'huevos', 'pan']

int(3.5) nos dará 3 perdiendo así la parte flotante del número y lista_compras * 3 repetirá nuestra lista por si misma tres veces y en su mismo orden.

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay