# File: if1.py # Program to demonstrate an "if-else" statement # # Matt Bishop, MHI 289I, Fall 2024 # # # This shows the "if" statement in various forms # # n = int(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, 1, or 3") # # now read in a string and do a string comparison # s = input("Where do you go to school? ") if s == "UCD" or s == "ucd": print("I go to UC Davis") else: print("I go elsewhere")