Coursera课程Python for everyone:chapter9
2016-02-17 11:14
555 查看
Chapter 9 Quiz
10 试题Python lists maintain order and dictionaries do not maintain order
Python lists can store strings and dictionaries can only store words
Python dictionaries are a collection and lists are not a collection
Python lists store multiple values and dictionaries store a single value
Lambdas
Sequences
Associative arrays
Closures
0
-1
The program would fail with a traceback
candy
0
-1
'candy'
The program would fail with a traceback
False
True
Building a histogram counting the occurrences of various strings in a file
Splitting a line of input into words using a space as a delimiter
Computing an average of a set of numbers
Sorting a list of names into alphabetical order
counts[key] = (key in counts) + 1
counts[key] = counts.get(key,-1) + 1
counts[key] = (counts[key] * 1) + 1
counts[key] = key + 1
counts[key] = counts.get(key,0) + 1
It loops through all of the dictionaries in the program
It loops through the integers in the range from zero through the length of the dictionary
It loops through the keys in the dictionary
It loops through the values in the dictionary
items()
keys()
each()
all()
values()
The value to retrieve
To provide a default value if the key is not found
The key to retrieve
An alternate key to use if the first key cannot be found
相关文章推荐
- SQL Server 作业批量停止
- SQL2008定时任务作业创建教程
- 作业
- OS的处理机调度层次-01
- Linux系统使用crontab命令实现计划任务
- 初来宝地
- CFG桩施工组织设计
- 求助啊有会做网页的进
- 苦恼~
- 哪位仁兄帮我编译以下程序阿?
- e路通电子传真(实现企业传真无纸化办公)beta版震撼发布
- [Oracle Client and Net Service]Oracle Client安装及Net Service的配置
- 利用OMS自带工具做Oracle增量备份与恢复
- 最美又最遥远的回忆
- 误打误撞进了这里
- 求高人帮忙呀
- 成功的部门经理一周速成(转载)
- 进程的问题
- 我要努力!!!
- 教出一个优秀的女儿