-
-
Save parzibyte/7dbffa44c4ddf445aa95aa81bbb3626f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Crear un programa en Python que pida la edad de la persona y muestre un mensaje | |
dependiendo de la misma. De 0 a 2 años es bebé, de 3 a 11 es niño, de 12 a 17 es | |
adolescente, de 18 a 64 es adulto y de 65 o más es anciano. | |
@author parzibyte | |
""" | |
edad_como_cadena = input("Dime tu edad: ") | |
edad = int(edad_como_cadena) | |
# Ahora sí comparamos | |
if edad >= 0 and edad <= 2: | |
print("Bebé") | |
elif edad >= 3 and edad <= 11: | |
print("Niño") | |
elif edad >= 12 and edad <= 17: | |
print("Adolescente") | |
elif edad >= 18 and edad <= 64: | |
print("Adulto") | |
elif edad >= 65: | |
print("Anciano") | |
else: | |
print("Edad inválida") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment