Skip to content
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

Make sure to not set the rating as None in the read_book function #1

Open
jmcrey opened this issue Dec 25, 2018 · 0 comments
Open

Make sure to not set the rating as None in the read_book function #1

jmcrey opened this issue Dec 25, 2018 · 0 comments

Comments

@jmcrey
Copy link

jmcrey commented Dec 25, 2018

def read_book(self, book, rating):
rating = none
self.books[book] = rating

For this function, we don't want to set the rating variable to None because we want to ensure that the rating for the book is kept as the User input it. If we set the rating as None then we will not be able to capture what the User has rated the book they read. So, to capture each rating as input by the User, we should just remove that line and have the function become:

 def read_book(self, book, rating):
     self.books[book] = rating

Now the self.books dictionary will begin holding all the ratings as input by the user.

P.S. The function as it is will actually error out because none is not defined as a keyword in Python. In Python, a "none object" must is spelled with a capital "N" -> None.

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

No branches or pull requests

1 participant