Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
683 B
0
Indexable
Never
def check_password(user_password : str):

    suffix = ['%','$','#','@','!']

    if len(user_password) != 5 :
        return "Wrong password"

    for i in range(4):
        print(user_password[i])
        if int(user_password[i]) > 9 | int(user_password) < 0 :
            return "Wrong password"

    if str(user_password[4]) not in suffix :

        return "Wrong password"

    return "Correct password"

def enter_password():

    ask = "please enter password"
    print(ask)
    answer = str(input())
    while (check_password(answer) == "Wrong password") :
        print(ask+ ". Try again \n")
        answer = input()

    print("password saved !")


enter_password()