# # 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" # if n == 0: print("You typed a 0!") input("Continue? ") # # now, the "if-else" # if n == 0: print("You typed a 0!") else: print("You didn't type a 0") input("Continue? ") # # now, the "if-elif-else" # if n == 0: print("You typed a 0!") elif n == 1: print("You typed a 1!") elif n == 2: print("You typed a 2!") else: print("You didn't type a 0 or a 1 or a 2") input("Continue? ") # # now, the "nested if" # if n > 1: print("You typed something greater than 1!") if n < 3: print("You typed something greater than 1 and less than 3 -- or, 2") else: print("You typed something greater than 1 and not less than 3 -- or 3") else: print("You typed something not greater than 1!") if n < 1: print("You typed something not greater than 1 and less than 1 -- or, 0") else: print("You typed something not greater than 1 and not less than 1 -- or 1") input("Continue? ") pwd = input("Now type your password: ") if pwd == 'abcde': print("Log in successful . . . if this were a real login") else: print("Log in failed!")