You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fork this Repo clone it to your drive and do the exercises at: sept-19.py
If Then Else Flowcharts
A basic If statement
n = 10
if (n > 15):
print ("10 is less than 15")
print ("I am Not in if")
If with an Else
n = 20;
if (n < 15):
print ("n is smaller than 15")
print ("n is in if Block")
else:
print ("n is greater than 15")
print ("n in else Block")
print ("n not in if and not in else Block")
If Else Elif
n = 20
if (n == 10):
print ("i is 10")
elif (n == 15):
print ("i is 15")
elif (n == 20):
print ("n is 20")
else:
print ("n is not present")
Nested Ifs
n = 10
if (n == 10):
# First if statement
if (n < 15):
print ("n is smaller than 15")
# Nested - if statement
# Will only be executed if statement above
# it is true
if (n < 12):
print ("n is smaller than 12 too")
else:
print ("n is greater than 15")