Lecture Notes on 19 Sep 2012 # Conditionals if (cond): # do this if (cond): # do this else: # do that if (cond1): # do task1 elif (cond2): # do task2 else: # do task3 # Easter Sunday problem month = "" if (n == 3): month = "March" elif (n == 4): month = "April" else: month = "not valid month" verb = "" if (y < 2012): verb = "was" elif (y > 2012): verb = "will be" else: verb = "is" print ("In", y, "Easter Sunday", verb, "on", p, month) # Boolean expressions # boolean expression that evaluates to true if num is even (num % 2 == 0) # boolean expression that evaluates to true if num is between # 1 and 100 inclusive (num >= 1) and (num <= 100) # boolean expression that evaluates to true if num is between # 100 and 1000 and is divisible by 3 (num % 3 == 0) and (num >= 100) and (num <= 1000) # boolean expression that evaluates to true if num is outside # the range 1 and 10 (num < 1) or (num > 10)