DEV Community

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

Posted on • Edited on

2

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

Explica este código Python

Dificultad: Fácil

my_tuple = (1, 2, True, 3)
print(my_tuple.count(1))
Enter fullscreen mode Exit fullscreen mode

👉 A. 1
👉 B. 2
👉 C. 3
👉 D. Ninguno de los anteriores


Respuesta:

👉 B. 2

Recordemos que los booleanos en Python derivan del tipo number, entonces el valor True del ejemplo equivale a un 1.

Por ello al contar cuantos valores 1 existen el resultado es 2.

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more