This Python program shows you how you can use the conditional if else statement in Python to find the largest among three numbers and display the result.
How to Find the Largest Value among three numbers in Python?
# Author : Abandantcode.com # Python Program to Find the Largest Value Among Three Numbers number1 = 1 number2 = 65 number3 = 3 if (number1 >= number2) and (number1 >= number3): largestNumber = number1 elif (number2 >= number1) and (number2 >= number3): largestNumber = number2 else: largestNumber = number3 print("The largest number among 3 Numbers is ", largestNumber)
Output
The largest number among 3 Numbers is 65.
In the above python program, the input numbers are stored in the variables number1,number2,number3 respectively. The conditional if statements are used to check which one among the three numbers is largest.
Leave a Reply