Y
Y
yentokui2020-06-02 09:27:49
Python
yentokui, 2020-06-02 09:27:49

How to compare two arguments by number of characters?

I'm trying to write a simple program with a username and password.
The problem is that I don't know how to use the if argument to make it so that when entering a password of less than 8 characters, an error is generated.

username = input('Введите имя пользователя: ')
password = input('Введите пароль: ')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2020-06-02
@yentokui

password = ''
while len(password) < 8:
    password = input('Введите пароль: ')
    if len(password) < 8:print('Неправильно, давайте еще раз')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question