Write a program to find the largest of three numbers in Python
In this exercise, you will learn how to find the largest of three numbers using Python. Such a type of programming can improve the thinking power of a new developer to tackle a given issue. There are different ways to find the largest of the three numbers.
Find the largest number using if-else statement
In the given Python program, we are taking input from the user. The user enters three numbers and program find the biggest among three numbers using an if..elif..else statement.
Output of the above code -
Enter 1st number: 53 Enter 2nd number: 23 Enter 3rd number: 56 The greatest number is 56Find the largest number using max() function
Here, we have found the greatest of the three numbers by using the max() function.
Output of the above code -
Enter 1st number: 34 Enter 2nd number: 21 Enter 3rd number: 75 75 is the greatest numberFind the largest number using function
Here, we have defined a function to find the largest of 3 numbers in Python.
Output of the above code -
need an explanation for this answer? contact us directly to get an explanation for this answerEnter first number: 36 Enter second number: 62 Enter third number: 16 62.0 is the greatest number