# File: nearyPass.py # Author: Michael Neary # Date: 10/07/2016 # Section: Lecture 07 # Email: mneary1@umbc.edu # Description: # Allow the user 3 tries to guess a password. def main(): print("Welcome to the password guessing program~~!") #setup constants and variables NUM_TRIES = 3 password = "datboispassword" tryCounter = 1 #guess = input("Please enter the password: ") guess = "" #get another try if they were incorrect and still have tries left while (guess != password) and (tryCounter <= NUM_TRIES): guess = input("That was incorrect, please try again: ") tryCounter = tryCounter + 1 #congratulate them if they won if guess == password: print("Congrats you have hacked my system.") else: print("Nice try, Nosferatu.") main()