From 3d37ca2f5cee3c5f32a20eef102fa6434da188a5 Mon Sep 17 00:00:00 2001 From: Wade Tsai Date: Thu, 11 May 2017 16:10:47 +0800 Subject: [PATCH] Line 120 is wrong, it should be: for interest in interests_by_user_id[user_id] --- code-python3/introduction.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code-python3/introduction.py b/code-python3/introduction.py index 0ab30cba..1adee4d4 100644 --- a/code-python3/introduction.py +++ b/code-python3/introduction.py @@ -18,8 +18,7 @@ { "id": 6, "name": "Hicks" }, { "id": 7, "name": "Devin" }, { "id": 8, "name": "Kate" }, - { "id": 9, "name": "Klein" }, - { "id": 10, "name": "Jen" } + { "id": 9, "name": "Klein" } ] friendships = [(0, 1), (0, 2), (1, 2), (1, 3), (2, 3), (3, 4), @@ -117,7 +116,7 @@ def data_scientists_who_like(target_interest): def most_common_interests_with(user_id): return Counter(interested_user_id - for interest in interests_by_user_id["user_id"] + for interest in interests_by_user_id[user_id] for interested_user_id in user_ids_by_interest[interest] if interested_user_id != user_id)