Python Program to find largest among three numbers

Python Program to find largest among three numbers

In this, we discuss how to write a Python program to find the largest of the three input numbers. To understand the following program, you must have the knowledge to follow Python concepts:

Introduction to Python

Basics of Python

Python Program to find largest among three input numbers entered by user

In the next Python application, we take input from the user. The user enters three numbers and the system obtains the largest of the three numbers using the if..elif..else statement. Here we use the float () function by taking input from user

Let's take a look how to write a Python Program to find largest among three numbers.

Python code:

x = float(input('enter value of x:'))
y = float(input('enter value of y:'))
z = float(input('enter value of z:'))
if (x>y and x>z):
print('x is greatest')
print(x)
elif(y>z and y>x):
print('y is greatest')
print(y)
else:
print('z is greatest')
print(z)

Output:
enter value of x: 79
enter value of y: 45
enter value of z: 56
x is greatest
79.0