From b494d03e5ea6950bca4b68f352117fdca3180555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A1ssila=20Kirst?= Date: Wed, 26 Oct 2022 16:39:28 -0300 Subject: [PATCH] Fixing code that tries to get index of an integer. --- scratch/introduction.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scratch/introduction.py b/scratch/introduction.py index 97580842..ba14258e 100644 --- a/scratch/introduction.py +++ b/scratch/introduction.py @@ -139,12 +139,13 @@ def data_scientists_who_like(target_interest): for user_id, interest in interests: interests_by_user_id[user_id].append(interest) -def most_common_interests_with(user): +def most_common_interests_with(target_user): + user = users[target_user]["id"] return Counter( interested_user_id - for interest in interests_by_user_id[user["id"]] + for interest in interests_by_user_id[user] for interested_user_id in user_ids_by_interest[interest] - if interested_user_id != user["id"] + if interested_user_id != user ) salaries_and_tenures = [(83000, 8.7), (88000, 8.1),