print('Buenas, por favor las 3 personas ingresen su nombre y su edad para determinar quien es el menor y el mayor')

nombre1= input()
edad1= int(input())
nombre2= input()
edad2= int(input())
nombre3= input()
edad3= int(input())

print(f"{nombre1} tiene {edad1} años, {nombre2} tiene {edad2} años y {nombre3} tiene {edad3} años")

if edad1 >= edad2 and edad1 >= edad3:
    mayor = (nombre1, edad1)
elif edad2 >= edad1 and edad2 >= edad3:
    mayor = (nombre2, edad2)
else:
    mayor = (nombre3, edad3)

if edad1 <= edad2 and edad1 <= edad3:
    menor = (nombre1, edad1)
elif edad2 <= edad1 and edad2 <= edad3:
    menor = (nombre2, edad2)
else:
    menor = (nombre3, edad3)

print(f"La persona mayor es {mayor[0]} con {mayor[1]} años.")
print(f"La persona menor es {menor[0]} con {menor[1]} años.")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: