DEV Community 👩‍💻👨‍💻


Posted on

Python code to check which number is greater.

Python program to find the largest number among the three input numbers

take three numbers from user

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

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

print("The largest number is",largest)

*Sample Output:

Enter first number: 100
Enter second number: 120
Enter third number: 10
The largest number is 120

Top comments (0)


Thank you.

Thanks for visiting DEV, we’ve worked really hard to cultivate this great community and would love to have you join us. If you’d like to create an account, you can sign up here.