您的位置:首页 > 编程语言 > Python开发

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息