Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

terahratheheart
Copy link

No description provided.

# print("****** before execution *****")
# print(user_data)
watchlist = user_data["watchlist"]
for i in range(len(watchlist)):

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"])

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)

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?

Comment on lines +91 to +92
if title["title"] not in userlist:
if title not in unique_watched:

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:

Comment on lines +104 to +105
for title in user_watched_list:
users_list_of_watched_titles.append(title["title"])

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:

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/

@jbieniosek
Copy link

jbieniosek commented Apr 2, 2021

Great work on this project! Something to think about for the next project:

  1. Helper functions can help improve the readability of code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants