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 ...
随机推荐
- 『cs231n』通过代码理解风格迁移
『cs231n』卷积神经网络的可视化应用 文件目录 vgg16.py import os import numpy as np import tensorflow as tf from downloa ...
- UI基础六:UI报弹窗确认
数据检查部分: IF gv_zzzcustmodeno1 <> gv_zzzcustmodeno2 AND gv_plg_name NE 'YES'. lv_title = 'Confir ...
- Liunx下安装jdk7
一. 查询系统中是否有安装过jdk: # rpm -qa | grep java 查询到有安装,使用命令卸载: # rpm -e --nodeps java-1.6.0-openjdk-1.6.0 ...
- 【转】JS常用函数整合库 lutils
lutils 此工具包是在 outils 的基础上,加上个人平时收集的代码片段进行的二次整合 outils的GitHub:https://github.com/proYang/outils/blob/ ...
- ActiveMQ 消息的重新投递
正常情况下:consumer 消费完消息后,会发送"标准确认"给 broker,这个确认对象以 MessageAck 类表征: // 省略其他代码.类中定义了各种确认的类型 pub ...
- mfscli的使用方法(解决mfscgi响应慢的问题)
在moosefs中,mfscgi是一个python写的server程序,其中的数据是调用同样的python工具mfscli实现的. 每当用浏览器打开mfscgi的时候,它要把所有的表数据请求一遍,非常 ...
- js 手机号码和电话号码正则校验
checkPhone() { var mobile = ''; var tel = /^0\d{2,3}-?\d{7,8}$/; var phone = /^(((13[0-9]{1})|(15[0- ...
- shell shell基本概述
SHELL的概念 SHELL是一个命令行解释器,它为用户提供了一个向Linux内核发送请求以便运行程序的界面系统级程序, 用户可以用shell来启动,挂起,停止甚至是编写一些程序. Shell还是 ...
- window有哪些属性?
self:self代表自己,相当于window. parent:返回父窗口. top:返回顶层窗口,和parent作用一样. opener:窗口开启者. status:设置窗口状态栏的文本.
- day16-python常用的内置模块2
logging模块的使用 一:日志是我们排查问题的关键利器,写好日志记录,当我们发生问题时,可以快速定位代码范围进行修改.Python有给我们开发者们提供好的日志模块,下面我们就来介绍一下loggin ...