Dremendo Tag Line

Input numbers and print the smallest in Python

if elif - Question 7

In this question, we will see how to input 3 unique integers and print the smallest among them in Python programming using the if elif statement. To know more about if elif statement click on the if elif statement lesson.

Q7) Write a program in Python to input 3 unique integers and print the smallest among them. Make use of logical operator && to solve this question.

Program

print('Enter 3 unique numbers')
a=int(input())
b=int(input())
c=int(input())

if a==b or b==c or c==a:
    print('Please enter 3 unique numbers')
elif a<b and a<c:
    print('Smallest number is {}'.format(a))
elif b<a and b<c:
    print('Smallest number is {}'.format(b))
else:
    print('Smallest number is {}'.format(c))

Output

Enter 3 unique numbers
78
34
9
Smallest number is 9
video-poster