Python – Largest of Three Numbers

 

LARGEST OF THREE NUMBERS IN PYTHON

 

Program

 

# Python program to find the largest of three input numbers

 

# Lines to take three numbers from user

num1 = float(input(“Enter the first number: “))

num2 = float(input(“Enter the second number: “))

num3 = float(input(“Enter the third number: “))

 

# Comparison to evaluate the largest number

if (num1 >= num2) and (num1 >= num3):

largest = num1

elif (num2 >= num1) and (num2 >= num3):

largest = num2

else:

largest = num3

 

# Printing the result

print(“The largest number between “,num1,”,”,num2,” and “,num3,” is “,largest)

input(“Press Enter to Exit”)

 

Output