python user login C

mission details

Realize that the user enters the user name and password. When the user name is admin or administrator and the password is 012345, it will display "login successful", otherwise it will display "login failed". When the login fails, repeated input is allowed three times.

code show as below:

n = 0
while n<3:
    u = input()
    p = input()
    if u == 'admin' and p == '012345' or u == 'administrator' and p == '012345':
        print('登录成功')
        break
    else:
        print('登录失败')
    n += 1

Guess you like

Origin blog.csdn.net/m0_70456205/article/details/129542584