DEV Community

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

Posted on • Edited on

2

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

Explica este código Python

Dificultad: Fácil

x = (1,"2",3)
print(list(x))
Enter fullscreen mode Exit fullscreen mode

👉 A. (1,"2",3)
👉 B. [1, 2, 3]
👉 C. [1, "2", 3]
👉 D. SyntaxError


Respuesta:

👉 C. [1, "2", 3]

La función list es muy útil para poder convertir iterables a listas. En nuestro ejemplo convertimos la tupla x a una lista respetando el tipo de dato de cada elemento.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more