Sep-29-2018, 12:35 PM
Hey guys so I am writing a basic code which asks you for a password to enter. If you get the password wrong 3 times in a row then you get a time penalty. Everything works except if you get the password wrong I can’t get it to count how many times it has been wrong
password = ('password') count = 0 def guessing(): guess = raw_input('Please enter the password or type cancel to go exit: ') if guess == 'cancel': print ('Cancelling..') else: password_guess(guess, password, count) def password_guess(guess, password, count): if guess == password: print ('Password correct!') print('Now opening program') else: print ('Password incorrect!') check_Count(count) def check_Count(count): count = count + 1 print (count) if count == 3: print ('You have entered the password wrong 3 times. please wait for 10 seconds') for i in range (count): print (count - i) else: guessing() guessing()Thanks in advance