Skip to content

Ana Gabriele- CEDAR C16#93

Open
Anagabsoares wants to merge 16 commits intoAda-C16:masterfrom
Anagabsoares:master
Open

Ana Gabriele- CEDAR C16#93
Anagabsoares wants to merge 16 commits intoAda-C16:masterfrom
Anagabsoares:master

Conversation

@Anagabsoares
Copy link

@Anagabsoares Anagabsoares commented Sep 17, 2021

I just watched the git lessons. I will work on my commit messages on the next project!

Copy link

@beccaelenzil beccaelenzil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on your first project. Your code is clear, readable, and you've met the learning goals. You've made good use of list comprehensions, and your use of helper function is particularly notable. I've left a few inline comments on ways you might consider refactoring. I look forward to discussing in our 1:1.



def most_frequent(list_value):
count = Counter(list_value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work researching this library. It would be a useful exercise to build a frequency map yourself: https://www.geeksforgeeks.org/counting-the-frequencies-in-a-list-using-dictionary-in-python/ .

Comment on lines +10 to +14
new_movie={
"title": movie_title,
"genre": genre,
"rating": rating}
return new_movie

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move this code outside the else. In general if indentation isn't necessary, we prefer less indentation

'''
helper functions
'''
def search_value(user_data,movie,search_for):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a clever way to use a helper function. Consider using a docstring (https://www.python.org/dev/peps/pep-0257/) and/or giving the function a bit more meaningful name to enhance readability.

Comment on lines +67 to +68
create_user_watched_list(user_data, user_watched_list)
create_friends_watched_list(user_data,friends_watched_list)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These helper functions are super handy and clear. Nice work!

create_user_watched_list(user_data, user_watched_list)
create_friends_watched_list(user_data,friends_watched_list)
unique_in_friends = set(friends_watched_list).difference(set(user_watched_list))
result = [{"title":item} for item in unique_in_friends]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of a list comprehension to get the data in the shape it needs to be

user_list = [item['title'] for item in user_data['watched']]
host_list = user_data['subscriptions']
create_friends_list(user_data,friends_list)
for i in friends_list:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable names like i are ok for counter variables, but try to provide more meaningful variable names for other use cases. In this case you might consider naming it movie.

Comment on lines +96 to +97
elif (not user_list and i['host'] in host_list) and (i not in recommendations):
recommendations.append(i)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that this second conditional test is not necessary. I believe the difference from the first test is it's checking an if user_list is empty, however if user_list is empty, i['title'] will not be in user list. Thus, it looks like your test case counts for this scenario.

favorites = [item['title'] for item in user_data["favorites"]]
friends_list = []
create_friends_watched_list(user_data,friends_list)
not_watched = set(favorites).difference(set(friends_list))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work trying out sets for this problem.

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

Comments