J
J
Janna16032020-05-09 14:40:30
Python
Janna1603, 2020-05-09 14:40:30

How to end my python program?

I want to write a program that accepts a password, checks against two criteria 1- It must be longer than 8 characters, 2- it must not contain "123" and "password", if the criteria match, the program must ask for the password a second time, and check for do they differ

while True:
    password1 = str(input("Введите пароль "))
    len(password1)
    if len(password1) < 8:
        print("Короткий!")
    elif "123" in password1 or "password" in password1:
        print("Простой!")
    password2 = str(input("Введите пароль еще раз "))
    if password1 == password2:
        print("OK")
        break
    else:
        print("Различаются!")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-05-09
@Janna1603

black_list = ['password']
while True:
    password1 = str(input("Введите пароль "))
    if len(password1) < 8:
        print("Короткий!")
        continue
    elif password1 in black_list:
        print("Простой!")
        continue
    password2 = str(input("Введите пароль еще раз "))
    if password1 == password2:
        print("OK")
        break
    else:
        print("Различаются!")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question