用户登陆练习
users = [‘root’,‘westos’]
passwd = [‘123’,‘456’]
trycount=0
while trycount < 3:
inuser = input(‘用户名:’)
inpasswd = input(‘密码:’)
trycount += 1
if inuser in users:
index = users.index(inuser)
passwd = passwd[index]
if inpasswd == passwd:
print(’%s登陆成功’ %inuser)
break
else:
print(’%s登录失败’ %inuser)
else:
print(’%s用户不存在’ %inuser)