-
Notifications
You must be signed in to change notification settings - Fork 94
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
Kristina K. - Maple #81
base: master
Are you sure you want to change the base?
Conversation
|
||
class Clothing(Item): | ||
def __init__(self, condition = 0): | ||
super().__init__(category = "Clothing", condition = 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.
great job on using inheritance here. Another way you could save some time on your code is to just leave condition
as is instead of condition = condition.
Nothing major just fyi.
return "some signs of wear" | ||
elif self.condition == 4: | ||
return "almost new" | ||
elif self.condition == 5: |
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.
the last one would just use else
elif self.condition == 5: | |
else: |
item_list.append(item) | ||
return item_list | ||
|
||
def swap_items(self, vendor, my_item, their_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.
great job!
else: | ||
return False | ||
|
||
def swap_first_item(self, vendor): |
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.
You already have a function that will do this work for you!swap_items()
can be called here and then you would pass in the first item of the vender and the other vendor as arguments
return self.swap_items(other, self.inventory[0], other.inventory[0])
vendor.inventory[0] = first_item_a | ||
return True | ||
|
||
def get_best_by_category(self, type): |
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.
💃🏽
|
||
if vendor_best_item == None or other_best_item == None: | ||
return False | ||
else: |
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.
you could also call swap_items()
here as well
Good Job! Your code was clean and readable. I added comments on refactoring some of your code and using helper functions. |
No description provided.