Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Realizar un programa que solicite el ingreso de 3 números y mostrar el mayor de ellos.
counter = 0
numbers = [0 , 0 , 0]
while counter < 3:
numbers[counter]= float(input('insert the {} number: '.format(counter +1)))
counter +=1
print('the highest number is : ', max(numbers))
# OTHER LOGIC IF YOUR NOT PERMIT USE MAX FUNCTION
counter = 0
numbers = [0 , 0 , 0]
hight = 0.0
while counter < 3:
numbers[counter]= float(input('insert the {} number: '.format(counter +1)))
if numbers[counter] >= hight:
hight = numbers[counter]
else:
pass
counter += 1
print('the highest number is : ', hight)
# USING LEGACY LOGIC
number_a = float(input("insert the one number: "))
number_b = float(input("insert the second number: "))
number_c = float(input("insert the third number: "))
if number_a > number_b and number_a > number_c:
print("the highest number is:", number_a)
elif number_b > number_a and number_b > number_c:
print("the highest number is:", number_b)
elif number_c > number_a and number_c > number_b:
print("the highest number is:", number_c)
else:
print("it's probably that two or three numbers are equals" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment