Daria Iakymenko (C17, Whales class)#100
Conversation
jericahuang
left a comment
There was a problem hiding this comment.
Excellent first project, Daria! You hit the learning goals and passed all the tests. 🙂🟢
You implemented every function according to the spec and had great code style throughout. Especially nice use of sets (no duplicates) and dictionaries (counting). Very nice additions to the test suite as well. See my line-by-line comments for some more detailed pointers for improvement as well as great highlights I saw. Keep up the fantastic work!
|
|
||
|
|
||
| def get_most_watched_genre(user_data): | ||
| most_watched = {} |
There was a problem hiding this comment.
Fantastic use of a dictionary to keep track of counts!
| ], | ||
| } | ||
|
|
||
| USER_ADDITIONAL_DATA_2 = { |
|
|
||
| # Assert | ||
| assert new_movie is None | ||
| assert new_movie == None |
There was a problem hiding this comment.
This check works and passes, but the preferred comparison operator is is for checking whether a variable is None. This article gives a good explanation.
| assert updated_data["watched"][1]["title"] == MOVIE_TITLE_1 | ||
| assert updated_data["watched"][1]["genre"] == GENRE_1 | ||
| assert updated_data["watched"][1]["rating"] == RATING_1 |
| assert janes_data == clean_wave_2_data() | ||
|
|
||
| @pytest.mark.skip() | ||
| def test_most_watched_genre_additional(): #added an additional test to make sure the function picks up |
| # ----------------------------------------- | ||
| def get_watched_avg_rating(user_data): | ||
| watched_movies_list = [] | ||
| sum = 0 |
There was a problem hiding this comment.
sum is considered a reserved word since it is a built-in function. We'd encourage to consider another variable name like summation!
| for item in user_data["watched"]: | ||
| watched_movies_list.append(item["rating"]) | ||
| for number in watched_movies_list: | ||
| sum += number |
There was a problem hiding this comment.
Nice; we also could've used the built-in sum function to sum up everything in this list by sum(watched_movies_list)
|
|
||
|
|
||
| def get_friends_unique_watched(user_data): | ||
| set_watched = set() |
There was a problem hiding this comment.
Awesome use of a set to track unique items!
| # ----------------------------------------- | ||
| # ------------- WAVE 4 -------------------- | ||
| # ----------------------------------------- | ||
| def get_available_recs(user_data): |
There was a problem hiding this comment.
Great implementation, though we could've used get_friends_unique_watched as a helper function to avoid any redundancy in code logic!
| return rec_by_genre_list | ||
|
|
||
|
|
||
| def get_rec_from_favorites(user_data): |
There was a problem hiding this comment.
Nice implementation, we could've also used get_unique_watched in both wave 5 functions as a helper function
No description provided.