Open gnaww opened 6 years ago
Thanks for the feedback! It's indeed unfortunate to only get 1 point because of one small mistake. So, what's the next step? Is this sufficient to pass the course or should I rewrite/improve my code? I'll probably have a look at it anyway based on your comments, but should I submit it again after making changes? Thanks!
You don't need to resubmit your project, this is more to help point out things you can improve on and things you did well!
Rubric Score
Criteria 1: Valid Python Code
So close here! You had the correct error checking for get_average_rating in class Book but didn't account for the same possibility of having 0 ratings in class User. Also, in get_average_rating for class Book if the book has no ratings the error message will print properly but Python will throw an error
UnboundLocalError: local variable 'average' referenced before assignment
forreturn average
.Criteria 2: Implementation of Project Requirements
Score Level: Meets Expectations (3)
Comment(s):
add_rating under class Book is almost correct, but it fails if a rating of 0 is added. Any numeric value of 0 is treated as a "falsy" value so
if rating:
doesn't pass and the 0 rating doesn't get added.most_positive_user gives an error due to the aforementioned errors above but is otherwise logically correct!
Great job however on the extra analysis methods
get_n_most_read_books
andget_n_most_prolific_readers
Criteria 3: Software Architecture
Great job with this! The classes are well defined and none of your functions are redundant, you use other already created functions where applicable. Also very nicely commented code, that is a great practice to have!
Criteria 4: Uses Python Language Features
Overall great job not remaking the wheel. There is one case where you could have used a Python built in function for finding the maximum value in a list/dictionary, you can look into a alternative way of doing it here: https://stackoverflow.com/questions/268272/getting-key-with-maximum-value-in-dictionary. Your way works great however! Another small thing, for blocks of code like
or
you can just do
return Book(title, isbn)
andreturn (self.title == other_book.title) and (self.isbn == other_book.isbn)
. It improves readability and lessens the amount you have to type!Overall Score: 11/16
Overall, still a really good job! A small mistake brought down your overall grade a lot but I can see that you have a good understanding of Python and all its features!