%格式化字符串的应用讲解

摘要: # msg ="我叫太阳, 今年29 身高162"# print(message)# name = input('请输入姓名:')# age =input('请输入年龄: ')# height =input('请输入身高: ')# msg ="我叫%s 今年%s 身高%s" % (name,age, 阅读全文
posted @ 2018-12-25 17:20 没有岁月可回头 阅读(181) 评论(0) 推荐(0) 编辑

用户登录(3次机会重试)

摘要: username =input('请输入账号: ')password =int (input('请输入密码: '))i=0while i< 3: if username =='机智姐'and password ==123: print('登录成功') else: print('登录失败请重新登录') 阅读全文
posted @ 2018-12-25 15:59 没有岁月可回头 阅读(349) 评论(1) 推荐(0) 编辑

求1-2+3-4+5......99的所有数的和

摘要: sum =0count =1while count <= 100: if count%2==0: sum=sum-count else: sum =sum + count count +=1 print(sum) 阅读全文
posted @ 2018-12-25 15:51 没有岁月可回头 阅读(400) 评论(1) 推荐(0) 编辑

打印1+2+3....100的所有数和

摘要: sum =0 count =1 while count <= 100: sum =sum + count count +=1 print(sum) 阅读全文
posted @ 2018-12-25 15:37 没有岁月可回头 阅读(262) 评论(0) 推荐(0) 编辑

输出1-100内的所有奇数

摘要: count =1 while count <101: print(count) count+= 2 阅读全文
posted @ 2018-12-25 15:25 没有岁月可回头 阅读(344) 评论(2) 推荐(0) 编辑

使用while 循环1234568910

摘要: count =0 while count<10: count +=1 #count =count+1 if count==7: continue else: print(count) 阅读全文
posted @ 2018-12-25 15:22 没有岁月可回头 阅读(524) 评论(0) 推荐(0) 编辑