python day02 作业答案
1.
(1).false (2).false
2.
(1).8 (2).4
3.
(1).6 (2).3 (3).false (4).3 (5).true (6).true (7).0 (8).3 (9).0 (10).2
4.
(1).while True:
循环体
else:
跳出循环执行这里
5.
count=1
while 1:
number=input("猜猜我的数字:")
if int(number)==66:
print("回答正确")
break
elif int(number)< 66:
print("猜小了")
else :
print("猜大了")
6.
count=1
while 1:
number=input("猜猜我的数字:")
if int(number)==66:
print("回答正确")
break
elif count ==2:
print("太笨了")
count=count+1
7.
count=1
while count<=10:
print(count)
count+=1
8.
count=1
sum=1
while count<=99:
count += 1
sum=sum+count
print(sum)
9.
count=1
while count<=100:
if count %2!=0:
print(count)
count += 1
10.
count=1
while count<=100:
if count %2==0:
print(count)
count += 1
11.
sum=1
count=1
while count<99:
count=count+1
if count %2 ==0:
sum=sum-count
else :
sum=sum+count
12.
count=1
while count<=3:
username = input('请输入用户名:')
password = input("请输入密码:")
if username=='apple' and password =='':
print('登陆成功')
break
else :
print("登陆失败")
print("还剩"+str(3-count)+"次")
count=count+1
13.
14.
a='最'
b='第一'
c='稀缺'
d='国家级'
ad=input("输入广告:")
if (a or b or c or d) in ad:
print("不合法")
else:
print('合法')
python day02 作业答案的更多相关文章
- python day10作业答案
2.def func(*args): sum = 0 for i in args: sum=sum+int(i) return sum a=func(2,3,9,6,8) print(a) 3. a= ...
- python day09作业答案
2. def lst(input): lst2=[] count=0 for i in range(0,len(input)): if i %2!=0: lst2.append(input[i]) r ...
- python day08作业答案
1. a f=open('11.txt','r',encoding='utf-8') a=f.read() print(a) f.flush() f.close() b. f=open('11.txt ...
- python day07作业答案
1. sum=0 a=input() for i in a: sum=sum+int(i)**3 if sum==int(a): print('水仙数') 2. lst=[100,2,6,9,1,10 ...
- python day06 作业答案
1. count=1 while count<11: fen=input('请第{}个评委打分' .format( count)) if int(fen) >5 and int(fen) ...
- python day05 作业答案
1. b.不可以 c.tu=("alex",[11,22,{"k1":"v1","k2":["age" ...
- python day04 作业答案
1. 1) li=['alex','WuSir','ritian','barry','wenzhou'] print(len(li)) 2) li=['alex','WuSir','ritian',' ...
- python day02作业
- C#基础第八天-作业答案-设计类-面向对象方式实现两个帐户之间转账
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
随机推荐
- Nodejs--url模块
由于GET请求直接被嵌入在路径中,URL是完整的请求路径,包括了?后面的部分,因此你可以手动解析后面的内容作为GET请求的参数. url 模块中的 parse 函数可以用于解析url中的参数. url ...
- 深入浅出php socket编程
对TCP/IP.UDP.Socket编程这些词你不会很陌生吧?随着网络技术的发展,这些词充斥着我们的耳朵.那么我想问: 1.什么是TCP/IP.UDP?2.Socket在哪里呢?3.Socket是什么 ...
- 搜索路径---PYTHONPATH 变量
- C#如何通过反射调用类下的方法
首先模拟一个mvc的项目,创建一个业务类(HomeService),在类下创建3个方法 public class HomeService { /// <summary> /// 无参方法 ...
- linux 安装Git详细过程
1.首先git --version 查看 Git https://mirrors.edge.kernel.org/pub/software/scm/git/ 2.下载 wget https://Gi ...
- Win10系列:VC++ Direct3D模板介绍3
(4)Render函数 默认定义在CubeRenderer.cpp源文件中的Render函数用于绘制立体图形,此函数的实现代码如下所示: void CubeRenderer::Render() { ...
- Win10系列:VC++媒体播放
媒体播放包括视频播放和音频播放,在开发Windows应用商店应用的过程中可以使用MediaElement控件来播放视频文件和音频文件.本节将通过一个具体的示例介绍如何使用MediaElement控件来 ...
- hibernate创建构架
创建hibernate架构: 注意:需要将所需的架包导进去: 二:Java工程的具体结构: 具体代码如下:hibernate.cfg.xml <!DOCTYPE hibernate-config ...
- markdown语法模板
(GitHub-Flavored) Markdown Editor Basic useful feature list: Ctrl+S / Cmd+S to save the file Ctrl+Sh ...
- CSS--margin塌陷
margin塌陷 解决方法: 1.给父级顶加上一条线,不太合适. 2.bfc block format context 设定bfc后,特定的盒子会遵循另一套语法规则,解决了margin塌陷 触发bfc ...