Python Program to Find Smallest of Two Numbers
This python program finds smallest of two numbers given by user.
First, two numbers are read from user and stored in variable first and second. After that decision of smallest in the program is made using python's if else
statement using relational operators like <, >, <=, <=
, etc
Python Source Code: Smallest of Two Numbers
# Finding smallest of two numbers
# Reading numbers
first = float(input('Enter first number: '))
second = float(input('Enter second number: '))
# Making decision and displaying
if first < second:
small = first
else:
small = second
print('Smallest = %d' %(small))
Python Smallest of Two Numbers Output
Run 1: ------------------ Enter first number: 33 Enter second number: 23 Smallest = 23 Run 2: ------------------ Enter first number: -45 Enter second number: 0 Smallest = -45