DEV Community

Cover image for Ibuprofeno.py💊| #104: Explica este código Python
Cristian Fernando
Cristian Fernando

Posted on • Edited on

1

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

Explica este código Python

Dificultad: Fácil

z = (4, 8, 12)
cuatro, ocho, doce = z
print(doce)
Enter fullscreen mode Exit fullscreen mode

👉 A. 4
👉 B. 8
👉 C. 12
👉 D. Ninguna de las anteriores


Respuesta:

👉 C. 12

Python posee una característica denominada desempaquetado (es muy similar a la desestructuración de JavaScript). Consiste en separar en variables individuales los items de una lista o una tupla.

En este caso separamos en 3 variables los 3 items de la tupla de manera posicional. Imprimimos 12 y eso es lo que mostramos por pantalla.

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay