Python四期爬虫作业

【Python爬虫】- 第5天复习

2017-08-15  本文已影响0人  悟道叔

一、填空题
1.python使用符号#_标示注释, 以 缩进 划分语句块。
2.python序列类型包括 listtuple 、__str____ 三种;__dict____ 是python中唯一的映射类型
3.python中可变的数据类型有num,list,tuple,str,set,dict ,不可变数据类型有____set,dict________
4.python的数字类型分为 ____int_____ 、float______ 、 bool______ 、____complex_____ 等子类型
5.设s = "abcdefg", 则s[3]值是d s[2:4]值是cd
,s[:5]值是abcde,s[3:]是def
,s[::-1]值是gfedcba
,s[::2]值是 aceg

二、选择题
1、关于 python 变量的使用,错误的是(b)

A、变量不必事先声明
B、变量无须先创建和赋值而直接使用
C、变量无须指定类型
D、可以使用del释放资源

2、下面哪个不是python合法标识符(b)

A、int32
B、40XL
C、self
D、name

3、python不支持的数据类型有(a)

A、char
B、int
C、float
D、list

4、关于字符串说法错误的是(b)

A、字符可以视为长度为1的字符串
B、字符串以\0标志字符串的结束
C、既可以用单引号,也可以用双引号创建字符串
D、在三引号字符串中可以包含换行回车等特殊字符

三、编程练习
1、计算1+2+3+4+.....+100的和

2、分别打印 a 与 b 加/减/乘/除/幂/商/余数的各个结果(共7个)

a=10 b=3

13
7
30
3.3333333333333335
2
3
1

3、9*9乘法口诀表

4、打印 dict_date 中 value 的年份在 1970~1976的 key
dict_date = {"Led Zeppelin":1969, "Led Zeppelin II": 1969, "Led Zeppelin III": 1970, "Led Zeppelin IV": 1971, "Houses of the Holy":1973, "Physical Graffiti": 1975, "Presence":1976, "In Through the Out Door":1979, "Coda":1982}

上一篇下一篇

猜你喜欢

热点阅读