To find largest or greatest of three numbers in python, you have to ask from user to enter three numbers to find and print the largest one among these three numbers as shown in the program given here.
Following python program ask from user to enter any three numbers and then find the largest one:
# Python Program - Find Largest of Three Numbers while True: print("Enter 'x' for exit.") print("Enter any three numbers: ") num1 = input() num2 = input() num3 = input() if num1 == 'x': break else: number1 = int(num1) number2 = int(num2) number3 = int(num3) largest = number1 if largest < number2: if number2 > number3: largest = number2 else: largest = number3 elif largest < number3: if number3 > number2: largest = number3 else: largest = number2 else: largest = number1 print("Largest of given three numbers is",largest,"\n")
Here are some sample runs of the above python program illustrating how to find largest of three numbers. This is first snapshot:
This is second snapshot:
You may also like to learn or practice the same program in other popular programming languages: