This program will help in understanding the if else logic in python .This is a program for finding the largest and smallest number . In python at the place of (” else if “) python use elif and at place of semicolon (;) python use colon (:) .

print("This program is for greater number and smallest number in three number")
a=int(input("Enter value of a "))
b=int(input("Enter value for b "))
c=int(input("Enter value for c "))
if a<=b and a<=c:
min=a
elif b<=c:
min=b
else :
min=c
if a>=b and a>=c:
max=a
elif b>=c:
max=b
else:
max=c
print(max,min)

Result of above program is

Thisprogram is for greater number in three number
Enter value of a 2
Enter value for b 3
Enter value for c 1
3 1

Comment for how to find middle number in three number.

### Like this:

Like Loading...

*Related*