0

I am creating a computer login code that will lock you out after an amount of faults. But the code returns the UnboundLocalError on the attempts variable. I have made attempts global but it hasn't changed anything. It is raised on

if (user == username) and (passwd == password):
    `print("You are logged on")`
else:
    attempts += 1
    if attempts == 3:
        print("You have been locked out of your computer")
        time.sleep(60)

All of this is in a function and attempts is made global. Can someone help?

0 Answers0