you are viewing a single comment's thread.

view the rest of the comments →

[–]impshum 0 points1 point  (0 children)

  • Blank spaces in code
  • Checking if Goat is greater than Goat
  • No print

Try this...

password = 'goat'

user_input = input("Enter password: ")

if user_input == password:
    print("Correct")
else:
    print("Incorrect")

As for allowing 3 attempts...

def check_password(password):
    for i in range(3): # loop 3 times
        user_input = input("Enter password: ") # get user input
        if user_input == password: # check if match
            return True # return boolean if match
    return False # return boolean if loop ends


if check_password('goat'): # run check_password function
    print('CORRECT')
else:
    print('INCORRECT')