会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
梦潇幻影
博客园
首页
新随笔
联系
管理
订阅
2018年10月20日
登陆(三次输错机会)且每次输错误时显示剩余错误次数(提示:使⽤字符串格式化)
摘要: # i = 3# username = "yangxiaoer"# password = "123456"# while i>=0:# name = input("请输入你的用户名:")# if name == username:# passwd = input("请输入你的密码:")# if pa
阅读全文
posted @ 2018-10-20 14:22 梦潇幻影
阅读(1118)
评论(0)
推荐(0)
2018年10月16日
用户登陆(三次机会重试)
摘要: 1 i = 0 2 while i < 3: 3 username = input('请输入账号:') 4 password = int(input('请输入密码:')) 5 if username == '咸鱼哥' and password == 123: 6 print('登录成功') 7 else: 8 print('登录失败...
阅读全文
posted @ 2018-10-16 00:12 梦潇幻影
阅读(250)
评论(0)
推荐(0)
求1-2+3-4+5 ... 99的所有数的和
摘要: 1 sum = 0 2 count = 1 3 while count < 100: 4 if count % 2 == 0: 5 sum = sum - count 6 else: 7 sum = sum + count 8 count += 1 9 print(sum)
阅读全文
posted @ 2018-10-16 00:11 梦潇幻影
阅读(268)
评论(0)
推荐(0)
输出 1-100 内的所有奇数
摘要: 1 方法一: 2 count = 1 3 while count < 101: 4 print(count) 5 count += 2 6 方法二: 7 count = 1 8 while count < 101: 9 if count % 2 == 1: 10 print(count) 11 count += ...
阅读全文
posted @ 2018-10-16 00:06 梦潇幻影
阅读(229)
评论(0)
推荐(0)
使用while循环输入 1 2 3 4 5 6 8 9 10
摘要: 1 count = 0 2 while count < 10: 3 count += 1 # count = count + 1 4 if count == 7: 5 print(' ') 6 else: 7 print(count) 8 9 count = 0 10 while count < 10: 11 ...
阅读全文
posted @ 2018-10-16 00:01 梦潇幻影
阅读(1022)
评论(0)
推荐(0)
公告