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

Panthers - Stevie L. #170

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

lopezsteffanie
Copy link

refactored party.py for list comprehension and readability

Copy link

@ameerrah9 ameerrah9 left a comment

Choose a reason for hiding this comment

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

Great job using the suggested refactoring! 🎉

Comment on lines +36 to +47
def watch_movie(user_data, title):
user_data_copy = user_data.copy()

title_list = [dicts["title"] for dicts in user_data["watchlist"]]
title_list.extend(dicts["title"] for dicts in user_data["watched"])

if title not in title_list:
return user_data
user_data_copy["watched"].append(user_data_copy["watchlist"].copy())
user_data_copy["watchlist"].pop()

return user_data_copy

Choose a reason for hiding this comment

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

You can simplify this by doing something like this:

def watch_movie(user_data, title):
    for movie in user_data["watchlist"]:
        if movie["title"] == title:
            user_data["watchlist"].remove(movie)
            user_data["watched"].append(movie)

    return user_data

# -----------------------------------------
# ------------- WAVE 2 --------------------
# -----------------------------------------
def get_watched_avg_rating(user_data):
watched_list = get_watched_list(user_data)

Choose a reason for hiding this comment

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

Nice work using your previous function!

Comment on lines +4 to +13
def get_watched_list(user_data):
return user_data['watched']

def get_friends_watched_list(user_data):
friends_list = user_data['friends']

friends_watch_list = [dicts['watched'] for dicts in friends_list]
friends_watch_list = [val for sublist in friends_watch_list for val in sublist]

return list({movie['title']:movie for movie in friends_watch_list}.values())

Choose a reason for hiding this comment

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

Nice work creating helper functions!

watched_list = get_watched_list(user_data)
genre_list = [movie['genre'] for movie in watched_list]

return max(genre_list, key = genre_list.count) if genre_list else None

Choose a reason for hiding this comment

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

💯💯

Comment on lines +80 to +87
watched_list = get_watched_list(user_data)
friends_list = get_friends_watched_list(user_data)

for movie in watched_list:
if movie in friends_list:
friends_list.remove(movie)

return friends_list

Choose a reason for hiding this comment

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

Amazing work! 😁

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