0

Sorry for my english but i have a question

I want to make a easy password check on python in anaconda3

Now i need a loop who finaly stopp when the password is corect, and if don't, he print "Wrong password" and ask again. That should be in the enterPasswort funtion, caus i will need it later again.

Thanks for your help :)

Maybe someone have an Idea, that the password have only five trys and than it locks for 5 minutes. No problem when no one have a answer on this, but it would be a great bonus.

1 Answers1

0
tries = 0#this will be the counter variable that will determin how much times 
we tried the password
password = input("choose a password: ")#lets user choos password
while tries < 5:#while he tried less than five times
    sign_in = input("what is your password?")#ask the passowrd
    if sign_in == password:#if sighn in which is what user said = to password which is the passowrd say signed in
        print("signed in succesfully")
        break
    else:#if not 
        if tries >= 4:#if he trie to much times
            print("you tried signing in to many times!")# tell him and block
            break
        else:#if not tell him and loop goes again
            print("wrong password trie again")
            tries += 1 #or tries = tries + 1#calculte how uch he tried and loop again
Codernad
  • 16
  • 1
  • here is the algorithm you should use and also remove hashtags if you want and pleas vote my answer up and mark this question as solved – Codernad Jan 13 '23 at 15:52