DEV Community

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

Posted on • Edited on

2

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

Explica este código Python

Dificultad: Intermedio

my_tuple = ("1", "20", "30", "9")
print(max(my_tuple))
Enter fullscreen mode Exit fullscreen mode

👉 A. 1
👉 B. 20
👉 C. 30
👉 D. 9


Respuesta:

👉 D. 9

Al comparar cadenas como items de una tupla usando max o min importa mas el valor como carácter y no como número.

En nuestro ejemplo tomamos el primer carácter de cada item y los comparamos entre ellos para hallar el máximo, el cual es 9.

Top comments (0)

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay