Dremendo Tag Line

Input numbers and print the largest in Python

if elif - Question 6

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

Q6) Write a program in Python to input 3 unique integers and print the largest 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('Largest number is {}'.format(a))
elif b>a and b>c:
    print('Largest number is {}'.format(b))
else:
    print('Largest number is {}'.format(c))

Output

Enter 3 unique numbers
15
28
7
Largest number is 28
video-poster