首页 > 其他 > 详细

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

时间:2020-01-03 10:43:09      阅读:111      评论:0      收藏:0      [点我收藏+]
#三次登是否继续

#三次登是否继续
count = 1
while count<=3:
username = input(请输入用户名:‘)
password = input(请输入密码‘)
n = 3-count
if username == ‘whzc‘ and password == ‘whzc‘:
print(欢迎登录‘)
break
else:
template = "用户名或密码错误,您还有%s次机会."%(n)
#字符格式化
print(template)

if count==3:
choice = input(请输入是否继续(Y/N‘)
if choice==‘N‘:
break
elif choice==‘Y‘:
count = 1
continue
else:
print(输入错误‘)
break
count+=1

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

原文:https://www.cnblogs.com/witchingsong/p/12143516.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!