Open
Conversation
spitsfire
reviewed
Sep 23, 2021
spitsfire
left a comment
There was a problem hiding this comment.
I know you didn't finish every way, Sabrina, but you still did a great job! I added a few suggestions on how to use less memory space by combining for loops and variables together in one.
Maybe if you have time over the break, you can come back to this and finish up the last few tests you have left!
| @@ -0,0 +1,129 @@ | |||
| #wave 1 | |||
|
|
|||
| def create_movie(title, genre, rating): | |||
viewing_party/party.py
Outdated
Comment on lines
4
to
9
| if title == None: | ||
| return None | ||
| if genre == None: | ||
| return None | ||
| if rating == None: | ||
| return None |
There was a problem hiding this comment.
since all of these if statements will produce the same return statement, let's combine them!
Suggested change
| if title == None: | |
| return None | |
| if genre == None: | |
| return None | |
| if rating == None: | |
| return None | |
| if title == None or genre == None or rating == None: | |
| return None |
| movie = {"title": title, "genre": genre, "rating": rating} | ||
| return movie | ||
|
|
||
| def add_to_watched(user_data, movie): |
| user_data['watched'].append(movie) | ||
| return user_data | ||
|
|
||
| def add_to_watchlist(user_data, movie): |
viewing_party/party.py
Outdated
Comment on lines
27
to
28
| if user_data['watched'] == []: | ||
| user_data["watched"].append(movie) |
There was a problem hiding this comment.
so, if user_data["watched"] is empty, no worries! it will still append the appropriate movie from the watchlist to the watched list on line 26. So we don't need this extra checking if statement:
Suggested change
| if user_data['watched'] == []: | |
| user_data["watched"].append(movie) |
viewing_party/party.py
Outdated
| unique_movies = [] | ||
| for friend in user_data["friends"]: | ||
| for movie in friend["watched"]: | ||
| if not is_movie_in_list(user_data["watched"], movie) and not is_movie_in_list(unique_movies, movie): |
|
|
||
| # wave 4 | ||
|
|
||
| def get_available_recs(user_data): |
|
|
||
| # #wave 5 pt1 | ||
|
|
||
| def get_new_rec_by_genre(user_data): |
|
|
||
| # wave 5 pt 2 | ||
|
|
||
| def get_rec_from_favorites(user_data): |
viewing_party/party.py
Outdated
|
|
||
| # helper | ||
|
|
||
| def is_movie_in_list(list, movie): |
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.