Skip to content

Ocelots - Jennifer Dai#22

Open
Jewelhae wants to merge 3 commits intoada-ac2:masterfrom
Jewelhae:master
Open

Ocelots - Jennifer Dai#22
Jewelhae wants to merge 3 commits intoada-ac2:masterfrom
Jewelhae:master

Conversation

@Jewelhae
Copy link
Copy Markdown

No description provided.

Comment thread viewing_party/party.py
def create_movie(title, genre, rating):
pass
movie = {}
if title == None or genre == None or rating == None:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What would happen with an empty string as one of the parameters?

Comment thread viewing_party/party.py
return user_data

def watch_movie(user_data,title):
for movie in user_data["watchlist"]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note, while this may work here, it's considered dangerous practice to modify the content of a data structure that you're looping over. Especially in more complex code, this can open you up to complex errors. A simple alternative here could be to save a copy of what you get from movie in user_data["watchlist"] and iterate over that, so that as you modify user_data["watchlist"], there's no risk.

Comment thread viewing_party/party.py


#return list of movie that friends watched
def friends_watched_movie(user_data):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could sets have been useful as an alternative to the nested loops?

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