 # Python Program to Find the Largest Among Three Numbers To find the greatest of three numbers in python, these three numbers must be taken as the input from the user, and the output of the program will determine the largest of all the numbers.

## To find Greatest of three Numbers in Python Source

Let us consider three numbers x,y,z.

If x=2, y=5, and z=8

The largest of the three numbers is z. Lets us see how we can find the python largest number with the help of the program given below: This can be done in three ways:

### Method 1:

                    
# Python program to find the largest

def maximum(x, y, z):

if (x >= y) and (x >= z):

largest = x

elif (y >= x) and (y >= z):

largest = y

else:

largest = z

return largest

Output:

Let us consider the values x=2, y=5, and z=8:

largest=8



### Method 2:

We can also find the greatest numbers with the help of a list. We first initialize three variables x,y,z, and add them to a list. Then using the max function, we can return the largest number from the list.

For example:

                    
def maximum(x, y, z):

list = [x, y, z]

return max(list)



Output:

Let us consider the values x=2, y=5, and z=8 then

largest=8

### Method 3:

The third method uses the max function. We use the library function to return the greatest of the three numbers.

For example:

Let us consider:

                    
x=2

y=5

z=8

print(max(x, y, z))



Output

8

### What is the max Number in Python?

The max number method in python returns the python largest number. The syntax for the max number function in Python is as follows:

max( x, y, z,..)

The parameters x,y,z in the above syntax are all numeric expressions. This method is used to return the largest numbers of the list.

For example:

                    
print "max (70, 900, 3000) :"

print "max (222, 45, 80) :"

print "max (70, 9040, 700) :"

print "max (7022, 9020, 300) :"

print "max (5555, 900, 6) :"

Output:

print "max (70, 900, 3000) : 3000

print "max (222, 45, 80) : 222

print "max (70, 9040, 700) : 9040

print "max (7022, 9020, 300) : 9020

print "max (5555, 900, 6) :"- 5555



### How do you find the greatest number in Python?

To find the greatest number in the Python programming language, the user can take the help of the list function and the max number function. The max function is used to return the highest or greatest number in the list that is given.

### How do you find the largest number in a list?

The largest number in the list can be found with the help of two functions:

### Method 1: By using the sort function

The sort function is used to sort the list in ascending order. After the list is sorted, the last number in the sorted list will be our largest element.

                    
lis = [100, 43, 400, 63, 65]

lis.sort()

print("Largest number in the list is:", lis[-1])



Output

The largest number in the list is 400

Method 2: With the help of the max()

                    
lis = [100, 43, 400, 63, 65]

print("Largest number in the list is:", max (lis))

Output:

The largest number in the list is 400



Share with friends  Customize your course in 30 seconds

Which class are you in?

5th
6th
7th
8th
9th
10th
11th
12th
Get ready for all-new Live Classes!
Now learn Live with India's best teachers. Join courses with the best schedule and enjoy fun and interactive classes.  Ashhar Firdausi
IIT Roorkee
Biology  Dr. Nazma Shaik
VTU
Chemistry  Gaurav Tiwari
APJAKTU
Physics
Get Started
Customize your course in 30 seconds

Which class are you in?

No thanks.