-
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 - Terah Bruce #53
base: master
Are you sure you want to change the base?
Conversation
# print("****** before execution *****") | ||
# print(user_data) | ||
watchlist = user_data["watchlist"] | ||
for i in range(len(watchlist)): |
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.
Consider using the for movie in watchlist
style for loop here.
return 0.0 | ||
else: | ||
for i in range(len(watchedlist)): | ||
ratings.append(watchedlist[i]["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.
ratings_sum += watchlist[i]["rating"]
genres[watchedlist[i]["genre"]] = 1 | ||
else: | ||
genres[watchedlist[i]["genre"]] += 1 | ||
sort_genres = sorted(genres.items(), key=lambda x: x[1], reverse=True) |
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.
How could you find the maximum if you didn't have access this function?
if title["title"] not in userlist: | ||
if title not in unique_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.
This style of chained if statements can be combined into one by and
-ing the conditionals together:
if title["title"] not in userlist and title not in unique_watched:
for title in user_watched_list: | ||
users_list_of_watched_titles.append(title["title"]) |
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 section of code is doing the same thing as lines 86 & 87 above, making this a great candidate for a helper function. Whenever the same code chunk is showing up multiple places consider pulling it out into a helper function.
friends_watched_list_of_dicts = friend["watched"] | ||
for movie in friends_watched_list_of_dicts: | ||
if movie["title"] not in users_list_of_watched_titles: | ||
if movie["genre"] is most_watched_genre: |
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.
In this conditional statement use ==
. For an explanation of is vs ==: https://www.geeksforgeeks.org/difference-operator-python/
Great work on this project! Something to think about for the next project:
|
No description provided.