diff options
author | Hui Lan <lanhui@zjnu.edu.cn> | 2019-04-01 21:01:18 +0800 |
---|---|---|
committer | Hui Lan <lanhui@zjnu.edu.cn> | 2019-04-01 21:01:18 +0800 |
commit | 520be4fe4cd388fc772f9da9f6057e9997c1aa39 (patch) | |
tree | 81fe0a3e09a1459c1c6fc2dcc94469500555da9a /LectureNotesOnPython.rst | |
parent | ba3c61624bc224d0c5ef39b3c0f0c9ce6f426786 (diff) |
updated lecture notes
Diffstat (limited to 'LectureNotesOnPython.rst')
-rw-r--r-- | LectureNotesOnPython.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/LectureNotesOnPython.rst b/LectureNotesOnPython.rst index 3f1e76d..0aa6f53 100644 --- a/LectureNotesOnPython.rst +++ b/LectureNotesOnPython.rst @@ -439,7 +439,7 @@ in操作符 'seed' in 'banana' 练习:写出下面的函数,使得 -in_both('apples', 'oranges')返回'aes' +in_both('apples', 'oranges')返回'aes'。 字符串比较 @@ -842,7 +842,9 @@ item的顺序不可预测,不是按照创建时的顺序。 for x in lst: print('%s (%d)' % (x[0], x[1])) - + +练习: 改写函数 ``word_frequency`` , 使它能接受第三个参数, ``black_lst``。 ``black_lst`` 是包含要排除考虑的单词的列表。 例如, ``black_lst`` 可以是 ``['the', 'and', 'of', 'to']`` 。 + key与value互换 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |