-
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
Paper - Dani Sanchez #52
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.
Well Dani, this submission was darn near flawless. I couldn't find much to comment on here. I made a few suggestions on style, but otherwise this is excellent work. Well done.
@@ -0,0 +1,9 @@ | |||
from swap_meet.item import Item | |||
|
|||
class Clothing(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.
👍 Very clean child class
@@ -0,0 +1,32 @@ | |||
|
|||
|
|||
class 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.
👍
|
||
class Vendor: | ||
|
||
def __init__(self, inventory = None): |
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.
👍
return new_item | ||
|
||
#removes item_to_remove from self's inventory | ||
def remove(self, item_to_remove): |
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.
👍
return item_to_remove | ||
return False | ||
|
||
def get_by_category(self, 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.
👍
items_list.append(item) | ||
return items_list | ||
|
||
def swap_items(self, vendor_friend, 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.
👍
|
||
|
||
def swap_first_item(self, vendor_friend): | ||
if len(self.inventory) != 0 and len(vendor_friend.inventory) != 0: |
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 type of thing can be simplified a bit because []
is falsey.
if len(self.inventory) != 0 and len(vendor_friend.inventory) != 0: | |
if not self.inventory and not vendor_friend.inventory: |
return True | ||
return False | ||
|
||
def get_best_by_category(self, 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.
👍
return best_condition_item | ||
return None | ||
|
||
def swap_best_by_category(self, other, my_priority, their_priority): |
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.
👍
No description provided.