Open
Conversation
ilana-adadev
reviewed
Dec 1, 2022
| def create_movie(title, genre, rating): | ||
| pass | ||
| movie = {} | ||
| if title == None or genre == None or rating == None: |
There was a problem hiding this comment.
What would happen with an empty string as one of the parameters?
ilana-adadev
reviewed
Dec 1, 2022
| return user_data | ||
|
|
||
| def watch_movie(user_data,title): | ||
| for movie in user_data["watchlist"]: |
There was a problem hiding this comment.
Note, while this may work here, it's considered dangerous practice to modify the content of a data structure that you're looping over. Especially in more complex code, this can open you up to complex errors. A simple alternative here could be to save a copy of what you get from movie in user_data["watchlist"] and iterate over that, so that as you modify user_data["watchlist"], there's no risk.
ilana-adadev
reviewed
Dec 1, 2022
|
|
||
|
|
||
| #return list of movie that friends watched | ||
| def friends_watched_movie(user_data): |
There was a problem hiding this comment.
Could sets have been useful as an alternative to the nested loops?
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.