From 520be4fe4cd388fc772f9da9f6057e9997c1aa39 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Mon, 1 Apr 2019 21:01:18 +0800 Subject: updated lecture notes --- LectureNotesOnPython.html | 3 ++- LectureNotesOnPython.rst | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/LectureNotesOnPython.html b/LectureNotesOnPython.html index 4333633..eb0b066 100644 --- a/LectureNotesOnPython.html +++ b/LectureNotesOnPython.html @@ -815,7 +815,7 @@ A list of objects

'a' in 'banana' 'seed' in 'banana'

练习:写出下面的函数,使得 -in_both('apples', 'oranges')返回'aes'

+in_both('apples', 'oranges')返回'aes'。

字符串比较

@@ -1170,6 +1170,7 @@ error-prone(易错)

for x in lst: print('%s (%d)' % (x[0], x[1])) +

练习: 改写函数 word_frequency , 使它能接受第三个参数, black_lstblack_lst 是包含要排除考虑的单词的列表。 例如, black_lst 可以是 ['the', 'and', 'of', 'to']

key与value互换

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互换 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.1