Maple - Ayaka#77
Open
ayaka wants to merge 13 commits into
Open
Conversation
spitsfire
reviewed
Oct 9, 2021
spitsfire
left a comment
There was a problem hiding this comment.
good work, Ayaka!! I like how you solved returning the item with the best condition! Well done!
Comment on lines
+5
to
+6
| def __init__(self, condition=0, age=0): | ||
| super().__init__("Clothing", condition, age) |
There was a problem hiding this comment.
👍 good idea hardcoding "clothing" here since that will never change if you are creating an instance of Clothing!
| from .item import Item | ||
|
|
||
|
|
||
| class Decor(Item): |
| from .item import Item | ||
|
|
||
|
|
||
| class Electronics(Item): |
| @@ -1,2 +1,25 @@ | |||
| class Item: | |||
Comment on lines
+24
to
+25
| item = Item() | ||
| print(item) No newline at end of file |
There was a problem hiding this comment.
are you testing that the instance worked? Remember to get rid of any testing or debugging for your final submission
Suggested change
| item = Item() | |
| print(item) |
| items = self.inventory | ||
| return max(items, key=attrgetter("condition"), default=None) | ||
|
|
||
| def get_best_by_category(self, category): |
| """ | ||
| if items is None: | ||
| items = self.inventory | ||
| return min(items, key=attrgetter("category"), default=None) |
There was a problem hiding this comment.
did you mean "age" here?
Suggested change
| return min(items, key=attrgetter("category"), default=None) | |
| return min(items, key=attrgetter("age"), default=None) |
| items = self.inventory | ||
| return min(items, key=attrgetter("category"), default=None) | ||
|
|
||
| def swap_by_newest(self, other): |
| item_to_receive = other.get_newest() | ||
| return self.swap_items(other, item_to_give, item_to_receive) | ||
|
|
||
| def get_newest_by_category(self, category): |
| items = self.get_by_category(category) | ||
| return self.get_newest(items) | ||
|
|
||
| def swap_newest_by_category(self, other, category): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.