-
Notifications
You must be signed in to change notification settings - Fork 97
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
Spruce - Asya S #92
base: master
Are you sure you want to change the base?
Spruce - Asya S #92
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.
Great work Asya! You hit all the learning goals for the project and passed all the tests. You definitely earned a 🟢 on this project 🌲✨
I added comments primarily on ways to refactor and reuse functions from prior waves. In the future, I'd like to see more docstrings in your functions, especially where you are using functions/methods in Python that are not covered in our curriculum.
Feel free to refactor and improve on this project and do let me know if you want me to take another look for fun 😄
Keep up the great work!
@@ -2,6 +2,7 @@ | |||
|
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.
This README file didn't need to be pushed. You can use commands like git add <filename>
to ensure that you're only adding specific files to be tracked, committed, and pushed to Github.
#this is the function that creates a new movie | ||
def create_movie(title, genre, rating): | ||
|
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 highly suggest adding docstrings underneath function signatures. The docstrings are a neat way of adding multi-line comments, especially about the functions we are building. It's also a great way of providing notes to your future self.
This same advice can be applied to the rest of the functions in this project and future projects.
#this is the function that creates a new movie | |
def create_movie(title, genre, rating): | |
def create_movie(title, genre, rating): | |
''' | |
this is the function that creates a new movie | |
''' |
|
||
|
||
# function that that adds movie to watched list | ||
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.
👍
|
||
|
||
#add movie to movies to watch | ||
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 watch_movie(user_data,title): | ||
|
||
# if title is a movie in user's watchlist | ||
for movie in user_data['watchlist']: | ||
|
||
if title == movie['title']: | ||
|
||
user_data['watchlist'].remove(movie) | ||
user_data['watched'].append(movie) | ||
|
||
return 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.
Be careful about modifying a collection as you're iterating through it (watchlist). For this example, we're only removing a single instance of a movie, however, if there are multiple instances of that movie that could cause the rest of the items in the list to shift position and potentially skip over other items as the loop continues.
This case is fine, but let's proceed with caution when modifying a collection while iterating through it.
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.
|
||
|
||
# returns a list of movies that the friends have watched, but the user hasn't | ||
def get_friends_unique_watched(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.
👍
for friend in user_data['friends']: | ||
for movie in friend['watched']: | ||
if movie not in friend_watched: | ||
friend_watched.append(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.
Another good place to reuse the get_friends_unique_watched()
function
friend_watched = [] | ||
user_watched_titles = [] | ||
# get to iteration over subs list and friends hosts | ||
for friend in user_data['friends']: | ||
for movie in friend['watched']: | ||
friend_watched.append(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.
This would be a great place to reuse the get_friends_unique_watched() function.
|
||
# get a list of users faves | ||
def get_rec_from_favorites(user_data): | ||
rec_from_faves_list = [] |
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.
👍 Although this could also be a good spot to use the get_unique_watched()
function.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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.
You don't need all of this whitespace. To make your project neater and follow pep8 guidelines, you can have VS Code autoformat your files by right-clicking on a file in VS Code and select Format Document With... then select python from the drop-down menu. You'll then be prompted to install autopep8, click yes and the package will be installed within your virtual environment.
No description provided.