Open
Conversation
tgoslee
reviewed
Sep 21, 2021
Comment on lines
+2
to
+11
| def create_movie(title,genre,rating): | ||
| new_movie = {} | ||
| empty = None | ||
| if title and genre and rating: | ||
| new_movie["title"] = title | ||
| new_movie["genre"] = genre | ||
| new_movie["rating"] = rating | ||
| return new_movie | ||
| else: | ||
| return empty |
There was a problem hiding this comment.
This works great but you could just return the title. genre, and rating without doing new_movie = {} and empty = None
Suggested change
| def create_movie(title,genre,rating): | |
| new_movie = {} | |
| empty = None | |
| if title and genre and rating: | |
| new_movie["title"] = title | |
| new_movie["genre"] = genre | |
| new_movie["rating"] = rating | |
| return new_movie | |
| else: | |
| return empty | |
| def create_movie(title, genre, rating): | |
| if title == None or genre == None or rating == None: | |
| return None | |
| else: | |
| return { | |
| "title":title, | |
| "genre":genre, | |
| "rating":rating | |
| } |
tgoslee
reviewed
Sep 21, 2021
Comment on lines
+14
to
+15
| user_list = user_data["watched"] | ||
| user_list.append(movie) |
There was a problem hiding this comment.
this works great. You can also do user_data['watched'].append(movie)
tgoslee
reviewed
Sep 21, 2021
| user_list.append(movie) | ||
| return user_data | ||
|
|
||
| def add_to_watchlist(user_data,movie): |
tgoslee
reviewed
Sep 21, 2021
Comment on lines
+22
to
+29
| def watch_movie(user_data,title): | ||
| watch_list = user_data["watchlist"] | ||
|
|
||
| for movie in watch_list: | ||
| if title in movie.values(): | ||
| watched_movie = watch_list.pop() | ||
| user_data["watched"].append(watched_movie) | ||
| return user_data |
tgoslee
reviewed
Sep 21, 2021
|
|
||
|
|
||
| ##WAVE 02## | ||
| def get_watched_avg_rating(user_data): |
tgoslee
reviewed
Sep 21, 2021
| avg_rating = sum(ratings_list) / len(ratings_list) | ||
| return float(avg_rating) | ||
|
|
||
| def get_most_watched_genre(user_data): |
There was a problem hiding this comment.
great use of a frequency map and max method here
tgoslee
reviewed
Sep 21, 2021
| return most_watched | ||
|
|
||
| ## WAVE 03 ## | ||
| def get_unique_watched(user_data): |
tgoslee
reviewed
Sep 21, 2021
| user_unique_movies.append(movie) | ||
| return user_unique_movies | ||
|
|
||
| def get_friends_unique_watched(user_data): |
tgoslee
reviewed
Sep 21, 2021
| ## WAVE 04 ## | ||
| def get_available_recs(user_data): | ||
| user_subscriptions = user_data["subscriptions"] | ||
| user_watched_titles = [movie["title"] for movie in user_data["watched"]] |
There was a problem hiding this comment.
ok I see you using list comprehension 💁🏽♀️
tgoslee
reviewed
Sep 21, 2021
| return friends_unique_movies | ||
|
|
||
| ## WAVE 04 ## | ||
| def get_available_recs(user_data): |
There was a problem hiding this comment.
How could you use the previously created function get_friends_unique_watched(user_data) here?
tgoslee
reviewed
Sep 21, 2021
Comment on lines
+103
to
+104
| user_most_watched = get_most_watched_genre(user_data) | ||
| user_unwatched = get_friends_unique_watched(user_data) |
tgoslee
reviewed
Sep 21, 2021
| movie_recommendations.append(movie) | ||
| return movie_recommendations | ||
|
|
||
| def get_rec_from_favorites(user_data): |
|
Great Job! I just added some comments on places you can refactor your code and the use of helper functions! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.