Python——用户登陆(三次机会)

user = 'hsjhj'
passwd = 'admin'
count = 3
while count > 0:
    name = input('请输入用户名:')
    pwd = input("请输入密码:")
    if name == user and pwd == passwd:
        print('欢迎登陆')
        break
    count -= 1
    print('你的输入有误,你还剩余%s次' % count)

 

posted @ 2019-07-09 11:44  韦礼维  阅读(1022)  评论(0编辑  收藏  举报