I want the counter to reset to zero after the 30-second timer ends so if the user gets it wrong 3 times they can retry after the time is up. I'm using python btw
here is the section I need help with:
count=0
while count < 3:
#the user is asked to input their username and password
username = input(Fore.WHITE + 'Enter username: ')
password = input(Fore.WHITE + 'Enter password: ')
if password == new_password and username == new_username:
print(Fore.GREEN + 'Access granted')
count += 0
break
else:
print(Fore.RED + 'Access denied. Try again.')
count += 1
# import the time feature into the program
import time
# define the countdown func.
def countdown(t):
if count == 3:
while t:
mins, secs = divmod(t, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
print(timer, end="\r")
time.sleep(1)
t -= 1
print ('you can try again in :')
else:
print ("welcome",new_username,"here are your files")
# the time in seconds
t = 30
countdown(int(t))