# File: moWePassword.py # Author: Dr. Gibson # Date: 9/26/2016 # Section: N/A # E-mail: k.gibson@umbc.edu # Description: # This file contains python code that allows the user # to guess a password, stopping them once they're reached # 3 tries or guessed correctly, and prints out a message. def main(): MAX_TRIES = 3 password = "dogsRule" # get a guess from the user guess = input("What is your guess for the password? ") numTries = 1 # if they guessed wrong and they have tries left while guess != password and numTries < MAX_TRIES: print("Whoops, you guessed wrong.") guess = input("Guess the password again: ") numTries = numTries + 1 # checked if they guessed the password, and respond appropriately if guess == password: print("You guessed my super secret ultra duper awesome password! :(") else: print("Haha, loser.") main()