Python Program to Find Largest of Three Numbers

This python program finds largest of three numbers given by user.

In this program, three numbers are read from user and stored in variable first, second and third. After that decision of largest among three is made using python's if elif else statement.

Python Source Code: Largest of Three Numbers


# Finding largest of three numbers

# Reading numbers
first = float(input('Enter first number: '))
second = float(input('Enter second number: '))
third = float(input('Enter third number: '))

# Making decision and displaying
if first >= second and first>=third:
    large = first
elif second >= first and second >= third:
    large = second
else:
    large = third

print('Largest = %d' %(large))

Python Largest of Two Numbers Output

Run 1:
------------------
Enter first number: 32
Enter second number: 33
Enter third number: 45
Largest = 45

Run 2:
------------------
Enter first number: -8
Enter second number: 23
Enter third number: 12
Largest = 23