IF Condition in Python

If: it is a conditional statement

Syntax:
1)         if expression:
statement(s)
2)         if expression:
statement(s)
else:
statement(s)
3)
if expression1:
statement(s)
elif expression2:
statement(s)
elif expression3:
statement(s)
else:
statement(s)

 

 

 

4)          if expression1:
statement(s)
if expression2:
statement(s)
elif expression3:
statement(s)
else:
statement(s)
elif expression4:
statement(s)
else:
statement(s)

 

find the big nuber out of 2 numbers

a=int(input("enter 1st no"));
b=int(input("enter 2nd no"));
if a>b:
print(a,"is big")
else:
print(b,"is big")

find the big number out of 3 numbers

a=int(input("enter 1st no"));
b=int(input("enter 2nd no"));
c=int(input("enter 3nd no"));
if a>b and a>c:
print(a,"is big")
elif b>c:
print(b,"is big")
else:
print(c," is big")

 

 

For
More Explanation
&
Online Classes

Contact Us:
+919885348743