Python Program to Find Smallest of Three Numbers

This python program finds smallest 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 smallest among three is made using python'sif elif else statement.

Python Source Code: Smallest of Three Numbers


# Finding smallest 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:
    small = first
elif second >= first and second >= third:
    small = second
else:
    small = third

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

Python Smallest of Two Numbers Output

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

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