-
Notifications
You must be signed in to change notification settings - Fork 71
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
Rock- Briyana Haywood #68
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.
Great job Briyana! You hit all the learning goals. I've seen a great improvement code style since viewing party!
Keep up the good work! 🥳
class Clothing(Item): | ||
def __init__(self, condition = 0): | ||
self.category = "Clothing" | ||
self.condition = condition | ||
def __str__(self): | ||
return "The finest clothing you could wear." |
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.
To refactor and truly inherit from the Item
class, you can use a super() constructor like so:
class Clothing(Item): | |
def __init__(self, condition = 0): | |
self.category = "Clothing" | |
self.condition = condition | |
def __str__(self): | |
return "The finest clothing you could wear." | |
class Clothing(Item): | |
def __init__(self, condition = 0): | |
super().__init__(self, category = "Clothing", condition) | |
def __str__(self): | |
return "The finest clothing you could wear." |
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.
This same logic can also be used for Decor and Electronics.
def condition_description(self): | ||
if self.condition == 0: | ||
return "Poor" | ||
elif self.condition <= 1: | ||
return "Fair" | ||
elif self.condition <= 2: | ||
return "Gently Used" | ||
elif self.condition <= 3: | ||
return "Good Condition" | ||
elif self.condition <= 4: | ||
return "Excellent Condition" | ||
elif self.condition <= 5: | ||
return "Like Brand New" | ||
else: | ||
return "Invalid Number" |
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.
This is great! It would also be good to check if condition
is expected to be an integer.
for items in list_by_category: | ||
if items.condition > best_item.condition: | ||
best_item = items | ||
return best_item |
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.
Nice 👍
my_category = other.get_best_by_category(my_priority) | ||
their_category = self.get_best_by_category(their_priority) | ||
return self.swap_items(other, their_category, my_category) |
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.
Great use of helper methods!
No description provided.