-
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--Andrea Palacios #55
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.
Nice work Andrea, you hit all the learning goals here. Well done. I had a few minor comments, mostly on programming style. Let me know if you have questions.
@@ -0,0 +1,10 @@ | |||
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 classes!
@@ -0,0 +1,22 @@ | |||
|
|||
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.
👍
self.inventory = inventory | ||
|
||
|
||
def add(self, 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.
👍
return item | ||
|
||
|
||
def remove(self, 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.
👍
else: | ||
return False |
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.
else: | |
return False | |
return False |
return False | ||
|
||
|
||
def swap_first_item(self, other): |
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.
👍 , just note that you don't need the else:
|
||
|
||
def swap_first_item(self, other): | ||
if len(self.inventory) == 0 or len(other.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.
You can simplify this a bit.
if len(self.inventory) == 0 or len(other.inventory) == 0: | |
if not self.inventory or not other.inventory: |
return True | ||
|
||
|
||
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.
👍
#[for item in items_list if item.condition > best_condition_item.condition] | ||
|
||
|
||
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.