Write a program that takes three numbers as input from the user, and prints the largest.
Sample Run
Enter a number: 20
Enter a number: 50
Enter a number: 5
Largest: 50
Hint: Remember that the numbers should be compared numerically. Any input from the user must be transformed into an integer, but printed as a string.
1
Expert's answer
2020-10-16T13:12:28-0400
numbers = [] #empty list to store numbers
for _ in range(3):
num = int(input("Enter a number:")) #user input
numbers.append(num) #append list with current number
print("Largest: ", max(numbers)) #print the largest number
Comments
Leave a comment