Python | Program to Find Largest of 3 Numbers

If you have three numbers and don’t know exactly which one of these three is largest. Then use below Python Code for finding which of three numbers is highest.

Python Code for Finding Highest Number

# Python code for checking largest of three numbers

num1 = float(input("Enter first number => "))
num2 = float(input("Enter second number => "))
num3 = float(input("Enter third number => "))

# Comparing three numbers to find largest
if (num1 >= num2) and (num1 >= num3):
	largest_number = num1
elif (num2 >= num3) and (num2 >= num3):
	largest_number = num2
else:
	largest_number = num3

# Printing out which number is largest of three numbers
print("Out of three numbers", num1,",", num2,",", num3)
print("\n")
print("Largest number is => ", largest_number)

Output of Above Code

Enter first number => 47
Enter second number => 37
Enter third number => 19

Out of three numbers 47.0 , 37.0 , 19.0

Largest number is =>  47.0

Gagan

Hi, there I'm founder of ComputerScienceHub(Started this to bring useful Computer Science information just at one place). Personally I've been doing JavaScript, Python development since 2015(Been long) - Worked upon couple of Web Development Projects, Did some Data Science stuff using Python. Nowadays primarily I work as Freelance JavaScript Developer(Web Developer) and on side-by-side managing team of Computer Science specialists at ComputerScienceHub.io

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts