Python Find the Largest Among 3 Numbers
Published on Nov 07, 2022
In this snippet, we'll learn to find the largest among 3 numbers using if else.
Have a look at the solution:
num1 = 5 num2 = 7 num3 = 2 # input from user # num1 = float(input("Enter 1st number: ")) if (num1 >= num2) and (num1 >= num3): largest = num1 elif (num2 >= num1) and (num2 >= num3): largest = num2 else: largest = num3 print("The largest number: ", largest)
The largest number: 7