Skip to content

C17 whales - Morgan Adkisson#109

Open
MorganAdkisson wants to merge 14 commits intoada-c17:masterfrom
MorganAdkisson:master
Open

C17 whales - Morgan Adkisson#109
MorganAdkisson wants to merge 14 commits intoada-c17:masterfrom
MorganAdkisson:master

Conversation

@MorganAdkisson
Copy link

No description provided.

Copy link

@kaidamasaki kaidamasaki 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!

I left a few style notes but overall everything looks good.

Well done!

Comment on lines +59 to +61
for rec in recommendations:
assert rec['genre'] == 'Intrigue'
assert len(recommendations) == 0

Choose a reason for hiding this comment

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

These assertions are kind of contradictory since the for loop should never be entered if the list is empty.

Suggested change
for rec in recommendations:
assert rec['genre'] == 'Intrigue'
assert len(recommendations) == 0
assert len(recommendations) == 0

Comment on lines +8 to +16
movie_dict = {}

if title and genre and rating:
movie_dict['title'] = title
movie_dict['genre'] = genre
movie_dict['rating'] = rating
else:
return None
return movie_dict

Choose a reason for hiding this comment

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

I generally find it clearer to return a dictionary literal instead of creating an empty dictionary and modifying it:

Suggested change
movie_dict = {}
if title and genre and rating:
movie_dict['title'] = title
movie_dict['genre'] = genre
movie_dict['rating'] = rating
else:
return None
return movie_dict
if title and genre and rating:
return {
'title': title,
'genre': genre,
'rating': rating
}
else:
return None

Comment on lines +27 to +30
for movie_dicts in user_data['watchlist']:
if movie_dicts['title'] == movie:
user_data['watched'].append(movie_dicts)
user_data['watchlist'].remove(movie_dicts)

Choose a reason for hiding this comment

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

Style: movie_dicts is only a single dict so shouldn't have a plural name:

Suggested change
for movie_dicts in user_data['watchlist']:
if movie_dicts['title'] == movie:
user_data['watched'].append(movie_dicts)
user_data['watchlist'].remove(movie_dicts)
for movie_dict in user_data['watchlist']:
if movie_dict['title'] == movie:
user_data['watched'].append(movie_dict)
user_data['watchlist'].remove(movie_dict)

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