s5_day1作业
2024-09-29 07:48:19
#1、使用while循环输出1 2 3 4 5 6 8 9 10
# s=0
# while s<10:
# s+=1
# if s==7:
# continue
# print(s)
# for i in range(1,11):
# if i==7:
# continue
# print(i)
# i += 1 #2、求1-100的所有数的和
# s=0
# i=0
# while i<100:
# i+=1
# s+=i
# print(s)
# s=0
# for i in range(1,101):
# s+=i
# print(s) #3、输出 1-100 内的所有奇数
# s=0
# while s<100:
# s+=1
# if s%2==1:
# print(s)
# for i in range(1,101):
# if i%2==1:
# print(i) #4、输出 1-100 内的所有偶数
# s=0
# while s<100:
# s+=1
# if s%2==0:
# print(s)
# for i in range(1,101):
# if i%2==0:
# print(i) #5、求1-2+3-4+5 ... 99的所有数的和
# s=0
# i=1
# while i<100:
# if i%2==1:
# s+=i
# elif i%2==0:
# s-=i
# i+=1
# print(s)
# s=0
# for i in range(1,100):
# if i%2==1:
# s+=i
# elif i%2==0:
# s-=i
# print(s) #6、用户登陆(三次机会重试)
# count=0
# while count<3:
# name=input('请输入用户名 ')
# passwd=input('请输入密码 ')
# if name=='z' and passwd=='123':
# print('登录成功')
# break
# else:
# print('用户名密码错误')
# count+=1 # 改进版
# user='z'
# pwd='123'
# count=0
# while count<3:
# username=input('请输入用户名 ')
# if username == user:
# passwd=input('请输入密码 ')
# if passwd==pwd:
# print('登陆成功')
# break
# else:
# print('密码错误,请重新输入')
# continue
# else:
# count += 1
# print('用户名错误,请重新输入')
# else:
# print('您输错了3次,已锁定')
最新文章
- form input file 图片上传360IE兼容问题
- DELPHI 读取csv 格式文本文件
- Objective-C(内存管理)
- [转]oracle pump expdp impdp使用
- [转]OOPC:Object-Oriented Programming in C
- php excel (转)
- 【转】1.5 起步 - 初次运行 Git 前的配置
- eclipse安装Flash Builder 4后变成中文,怎么解决
- 安装 node-sass 时报错
- zoj3211dream city dp 斜率
- HanLP Analysis for Elasticsearch
- ERROR 1044 (42000): Access denied for user 'root'@'localhost'
- php常用扩展安装
- 把你的Centos设置成代理ip服务器
- Jordan 块的几何
- 带列表写入文件出错先 json.dumps
- VMware设置inter共享连接出现空值
- Centos crontab定时任务
- 开启otl的64位长整数支持
- 017PHP基础知识——流程控制语句(五)
热门文章
- [Android] Ubuntu下Eclipse || Android Studio识别不了手机的官方解决方案
- TCP编程,Socket通讯
- Muller’s method (website)
- 【BZOJ】1596: [Usaco2008 Jan]电话网络(树形dp+特殊的技巧)
- js用计时器加载大量dom
- ORB特征提取与匹配
- Lenna图-莱娜&#183;瑟德贝里
- 图像增强:直方图均衡和小波变换【matlab】
- GIT 回退出错 Unlink of file &#39;xx&#39; failed. Should I try again? (y/n) 解决办法
- springMVC的url-pattern /和/*的区别