-
Notifications
You must be signed in to change notification settings - Fork 167
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
Devin - Lions #152
base: master
Are you sure you want to change the base?
Devin - Lions #152
Conversation
… the streaming services the user has
… genre and also completed the 3rd test
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.
Wonderful work, Devin! 🎉
I actually do want to print and frame your commit messages because they are the gold standard! ⭐ Your code also shines; I can tell that you understand nested loops, conditionals, testing and modifying lists. This project is a well-deserved Green. 🟢
Keep up the great work! 🎉
assert updated_data["watched"][0]["title"] == MOVIE_TITLE_1 | ||
assert updated_data["watched"][0]["genre"] == GENRE_1 | ||
assert updated_data["watched"][0]["rating"] == RATING_1 |
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.
Wonderful assert
statements! ✨
|
||
|
||
|
||
|
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.
Small nit: remove all the unnecessary whitespace before submitting! 😉
movie = None | ||
if title == None or genre == None or rating == None: | ||
movie == None | ||
else: | ||
movie = { | ||
"title" : title, | ||
"genre" : genre, | ||
"rating" : rating | ||
} | ||
return 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.
On L12, we check if movie
is None
, not reassigning movie as None
. We can also get rid of the temporary variable and return directly inside the else loop, like so:
if title == None or genre == None or rating == None:
return None
else:
return = {
"title": title,
"genre": genre,
"rating": rating
}
def watch_movie(user_data, title): | ||
for movie in user_data["watchlist"]: | ||
if title in movie["title"]: | ||
user_data["watchlist"].remove(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.
One danger of modifying the user_data
while iterating is that it could cause an error in our loop. Try to avoid modifying a list while you're iterating through it!
counter = 0 | ||
average = 0.0 | ||
for movie in user_data["watched"]: | ||
if movie["rating"] == False: |
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.
A more pythonic way to write this code is:
if not movie["rating"]:
# ----------------------------------------- | ||
# ------------- WAVE 4 -------------------- | ||
# ----------------------------------------- | ||
def get_available_recs(user_data): | ||
unwatched_movies = get_friends_unique_watched(user_data) |
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.
Nice job using get_friends_unique_watched()
! 🎉
for movie in unwatched_movies: | ||
if movie["host"] in user_data["subscriptions"]: | ||
movie_recs.append(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.
I feel like you can do this in your sleep now! 😴
|
||
# ----------------------------------------- | ||
# ------------- WAVE 5 -------------------- | ||
# ----------------------------------------- | ||
def get_new_rec_by_genre(user_data): | ||
unwatched_movies = get_friends_unique_watched(user_data) |
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.
- chefs kiss * 👨🏻🍳
unwatched_movies = get_friends_unique_watched(user_data) | ||
movie_recs = [] | ||
for movie in unwatched_movies: | ||
if movie["genre"] == get_most_watched_genre(user_data): |
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.
The efficiency! ⭐
for movie in user_data["favorites"]: | ||
if movie in unwatched_movies: | ||
movie_recs.append(movie) | ||
return movie_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.
Python likes a newline at the end of the file, otherwise Github shows a silly 🚫
No description provided.