代码1(while循环和IF条件语句)

#三次登是否继续

#三次登是否继续
count = 1
while count<=3:
username = input('请输入用户名:')
password = input('请输入密码')
n = 3-count
if username == 'whzc' and password == 'whzc':
print('欢迎登录')
break
else:
print('用户名或密码错误,您还有',n,' 次机会')
if count==3:
choice = input('请输入是否继续(Y/N')
if choice=='N':
break
elif choice=='Y':
count = 1
continue
else:
print('输入错误')
break
count+=1

猜你喜欢

转载自www.cnblogs.com/witchingsong/p/12143516.html