# File: if1.py # Program to demonstrate an "if-else" statement # # Matt Bishop, MHI 289I, Winter 2018 # # # This shows the "if" statement in various forms # # n = int(raw_input("Enter a 0 or a 1 or a 2 or a 3: ")) # # first, the "if" # print "First, the if" if n == 0: print "You typed a 0!" # # now, the "if-else" # print "Now the if ... else" if n == 0: print "You typed a 0!" elif n == 1: print "It's 1" elif n == 3: print "It's 3!!!!!" else: print "You didn't type a 0" # # now read in a string and do a string comparison # s = raw_input("Where?") if s == "UCD" or s == "ucd": print "I go to UC Davis" else: print "I go elsewhere"