Professional Documents
Culture Documents
if <conditional>:
statements
Change the example
● Example:
1. If 6:
print("Conditional True")
● 2. If -3:
print ("Conditional True")
if-else Statement
if marks>= 80
print("Excellent")
else:
print(" Well Done !!!")
if-elif statement
elif<condition2>:
statement(s)
when condition 2 is true
● elif<condition 3>:
statement(s)
when condition 3 is true
else
● Example:
a= int(input("Enter the number")
if a==10:
print("a is equal to 10")
elif a==20:
print ("a is equal to 20")
elif a==30:
print ("a is equal to 30")
else:
print ("Again Give the number")
Nested Statement
Output
Enter a number:5
Positive number