DEV Community

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

Posted on

1

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

Explica este código Python

Dificultad: Fácil

x = "Pepinillos"
z = (x[2:6] == "pini")
z = int(z)
print(z)
Enter fullscreen mode Exit fullscreen mode
  • A. 1
  • B. 2
  • C. 3
  • D. Error

Respuesta:

👉 A. 1

La condición (x[2:6] == "pini") evalúa True, luego intentamos convertir a entero dicho valor booleano, esto en Python es completamente posible siendo False equivalente a 0, y True equivalente a 1.

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

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