Conversation
kendallatada
left a comment
There was a problem hiding this comment.
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! :)
| if self.inventory == [] or other_vendor.inventory == []: | ||
| return False | ||
|
|
||
| tmp = self.inventory[0] |
There was a problem hiding this comment.
Small note - you could reuse the swap_items() method here to DRY your code
| best_item = item | ||
| return best_item | ||
|
|
||
| def swap_best_by_category(self, other, my_priority, their_priority): |
| category = "" | ||
| condition = 0 | ||
|
|
||
| def __init__(self, **kwargs): |
There was a problem hiding this comment.
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. :)
| return "Hello World!" | ||
|
|
||
| def condition_description(self): | ||
| return str(self.condition) No newline at end of file |
There was a problem hiding this comment.
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.
| return "The finest clothing you could wear." | ||
|
|
||
| def condition_description(self): | ||
| return str(self.condition) No newline at end of file |
There was a problem hiding this comment.
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.
note about method overriding applies here too
No description provided.