-
Notifications
You must be signed in to change notification settings - Fork 167
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
Tigers Lilian Mora #164
base: master
Are you sure you want to change the base?
Tigers Lilian Mora #164
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done, Lily! Great job passing all tests!
I've added some feedback throughout your project to point out some places we can refactor in order to follow common conventions and standard practices when it comes to Python.
Things to consider as you work on future projects:
- Get used to putting your edge case conditionals (aka guard clauses) at the tippy top of your functions.
- Stay consistent with your syntax. When assigning in Python, it is most common to put a space before and after the
=
sign.
|
||
from viewing_party.party import * | ||
from dataclasses import dataclass | ||
#from symbol import subscript | ||
from xml.dom import UserDataHandler | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need any of these imported packages. Sometimes VSCode tried to help us by auto-importing these lines when they think we are trying to type. Sometimes VSCode gets it very wrong.
Let's remove all of these
from viewing_party.party import * | |
from dataclasses import dataclass | |
#from symbol import subscript | |
from xml.dom import UserDataHandler | |
movie_dictionary = {} | ||
if title and genre and rating: | ||
movie_dictionary["title"] = title | ||
movie_dictionary["genre"] = genre | ||
movie_dictionary["rating"] = rating | ||
return movie_dictionary | ||
|
||
else: | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice job! 👍 I'd suggest flipping the sense of the condition around to handle the special case (that something is falsy) quickly and get out, rather than having that dangling else
at the end. This arrangement is referred to as a guard clause or a guard condition.
Notice that it lets us move the main focus of the function (creating the new dict) out of an indented block, letting it stand out more clearly.
def create_movie(movie_title, genre, rating):
if not movie_title or not genre or not rating:
return None
movie_dict = {'title':movie_title, 'genre':genre, 'rating':rating}
return movie_dict
return None | ||
|
||
def add_to_watched(user_data, movie): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure there are no blank lines between the function signature and the first indented line:
#"watched": [{"title": "{movie} "genre": "Horror", "rating": 3.5}, | ||
# {"title": "Title A", "genre": "Horror", "rating": 3.5}, | ||
# {"title": "Title A", "genre": "Horror", "rating": 3.5}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's get rid of any commented out code or test data we don't need when we turn in our final submission
#"watched": [{"title": "{movie} "genre": "Horror", "rating": 3.5}, | |
# {"title": "Title A", "genre": "Horror", "rating": 3.5}, | |
# {"title": "Title A", "genre": "Horror", "rating": 3.5}] |
# {"title": "Title A", "genre": "Horror", "rating": 3.5}, | ||
# {"title": "Title A", "genre": "Horror", "rating": 3.5}] | ||
|
||
def add_to_watchlist(user_data, movie): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
def get_new_rec_by_genre(user_data): | ||
recommended= [] | ||
friends_movies = get_friends_unique_watched(user_data) | ||
user_most_watched= get_most_watched_genre(user_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user_most_watched= get_most_watched_genre(user_data) | |
user_most_watched = get_most_watched_genre(user_data) | |
return recommended | ||
|
||
def get_rec_from_favorites(user_data): | ||
recommended= [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recommended= [] | |
recommended = [] | |
recommended.append(movie) | ||
return recommended | ||
|
||
def get_rec_from_favorites(user_data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
# ----------------------------------------- | ||
# ------------- WAVE 5 -------------------- | ||
# ----------------------------------------- | ||
|
||
def get_new_rec_by_genre(user_data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
# ----------------------------------------- | ||
# ------------- WAVE 4 -------------------- | ||
# ----------------------------------------- | ||
|
||
def get_available_recs(user_data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Hi Claire I will try to fix this by Saturday 9/24/2022! thank you.