Kristina K. - Maple#81
Conversation
|
|
||
| class Clothing(Item): | ||
| def __init__(self, condition = 0): | ||
| super().__init__(category = "Clothing", condition = condition) |
There was a problem hiding this comment.
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.
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): |
| else: | ||
| return False | ||
|
|
||
| def swap_first_item(self, vendor): |
There was a problem hiding this comment.
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): |
|
|
||
| if vendor_best_item == None or other_best_item == None: | ||
| return False | ||
| else: |
There was a problem hiding this comment.
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.