-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scissors - Lindsey #66
base: master
Are you sure you want to change the base?
Conversation
def get_watched_avg_rating(user_data): | ||
avg_rating = 0.0 | ||
for movie in user_data["watched"]: | ||
avg_rating = (movie["rating"])/len(user_data["watched"]) + avg_rating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a neat way to generate the average!
As an aside, another way to write this line is:
avg_rating += (movie["rating")/len(user_data["watched"])
# print(user_data["watched"]) | ||
|
||
watched = user_data["watched"] | ||
genre_freq_dict = calculate_genre_freq(watched) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great use of a helper function!
|
||
|
||
def get_friends_unique_watched(user_data): | ||
unique_movie = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For readability I recommend naming variables to reflect their contents - in this case this is a list of unique movies, so I would name it unique_movies
or unique_movie_list
def get_new_rec_by_genre(user_data): | ||
most_watched_genre = get_most_watched_genre(user_data) | ||
print(most_watched_genre) | ||
new_genre_recs = [] | ||
for friend in user_data["friends"]: | ||
for movie in friend["watched"]: | ||
if movie["genre"] == most_watched_genre and movie not in user_data["watched"]: | ||
new_genre_recs.append(movie) | ||
|
||
return new_genre_recs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use the function get_friends_unique_watched in this function? Also, this will pass the tests as written, but what if two friends have watched the same movie that fits the criteria (it's not in the user's watched list & it's the most watched genre)? Currently this will repeat the recommendation rather than giving only unique recommendations.
Great job! You hit the learning goals here. Overall, this was a fantastic first project, you should be proud! I left a few minor comments in the code, we will go over those at our 1:1. |
No description provided.