-
Notifications
You must be signed in to change notification settings - Fork 113
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
Otters_C17 - Doina's Swap-Meet Project #87
base: master
Are you sure you want to change the base?
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.
Hi Doina! Your submission has been scored as green. Please check your code to see the comments I left. Let me know if you have any questions. Nice work! :)
return False | ||
|
||
tmp = self.inventory[0] |
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.
Small note - you could reuse the swap_items()
method here to DRY your code
return best_item | ||
|
||
def swap_best_by_category(self, other, my_priority, their_priority): |
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.
Beautiful solution ✨
condition = 0 | ||
|
||
def __init__(self, **kwargs): |
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.
Ooo! Super cool that you're using **kwargs
! ✨ While you can implement the Item
class this way, it is best practice to explicitly list any required attributes in the parameters rather than using **kwargs
. Allowing users to pass any keyword arguments they would like leaves a lot of room for errors. This implementation would allow users to create an Item
instance that doesn't have category
or condition
attributes, which would lead to errors in how other classes use the object. Keep that in mind going forward, but I think it's really cool you're exploring different ways to pass arguments. :)
|
||
def condition_description(self): | ||
return str(self.condition) |
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 sure to read the requirements carefully! This function is supposed to return different descriptions based on the condition ranging from 0 to 5. (Wave 5)
also (small note), make sure to have a blank line at the end of your Python files. It's convention.
|
||
def condition_description(self): | ||
return str(self.condition) |
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.
Your Clothing
class is inheriting from Item
which means it automatically has the condition_description()
method defined in Item
, so you don't need to redefine the method in the child class. You only need to redefine the method in the child class when you want it to behave differently than the parent class's version which is called method overriding.
return "A gadget full of buttons and secrets." | ||
|
||
def condition_description(self): | ||
return str(self.condition) |
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.
note about method overriding applies here too
No description provided.