# Examples of if statements # Author: Dan Fleck def basic(temp): print "-" * 30 # Print 30 dashes print "Basic" if temp > 90: # Prints it is hot if the temp is over 90 degrees print "It is hot" print "End of Basic" def usingElse(temp): print "-" * 30 # Print 30 dashes print "usingElse" if temp > 90: print "It is hot" else: print "It is NOT hot" print "End of usingElse" def usingElif(temp): print "-" * 30 # Print 30 dashes print "usingElif" if temp > 90: print "It is hot" elif temp > 100: # "Else if" - can have as many as you want print "It is REALLY HOT!!" elif temp < 50: # "Else if" - can have as many as you want print "It is cold!" else: print "It is just right" print "End of usingElif" def main(): basic(100) basic(80) usingElse(100) usingElse(80) usingElif(105) usingElif(80) usingElif(30) usingElif(90) main()