Python Program to find largest of three numbers using function
In this program, You will learn how to find largest of three numbers using function in Python.
10 20 30 => 30
15 11 10 => 15
Example: How to find largest of three numbers using function in Python.
def largest(x, y, z):
if x > y and x > z:
return x
elif y > z:
return y
else:
return z
x = int(input("Enter first number:"))
y = int(input("Enter second number:"))
z = int(input("Enter third number:"))
result = largest(x, y, z)
print("Largest is:", result)
Output:
Enter first number:10
Enter second number:30
Enter third number:20
Largest is: 30