-
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_Manu #70
base: master
Are you sure you want to change the base?
paper_Manu #70
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 done Manu, this is a solid submission and you hit all the learning goals. I made a few comments, mostly on coding style.
Overall this is great work.
@@ -0,0 +1,11 @@ | |||
from swap_meet.item import 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,23 @@ | |||
#wave2 | |||
class Item(): #parens allow inheritance | |||
def __init__(self, category="", condition=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.
👍
self.category = category | ||
self.condition = condition | ||
|
||
def __str__(self): |
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 __str__(self): | ||
return("Hello World!") | ||
|
||
def condition_description(self): |
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, add_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.
👍
if len(self.inventory) == 0 or len(friend.inventory) == 0: | ||
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.
This is a little simpler due to the fact that []
is falsey.
if len(self.inventory) == 0 or len(friend.inventory) == 0: | |
return False | |
if not self.inventory or not friend.inventory: | |
return False |
return self.swap_items(friend, my_item, their_item) | ||
|
||
#wave6 | ||
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.
👍
#DRYup using swap_items | ||
#return self.swap_items(other, 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.
This would have been a good choice
best_by_category = item | ||
return best_by_category | ||
|
||
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.
👍
# if __name__ == "__main__": | ||
|
||
# from item import Item | ||
# item1 = Item("jacket") | ||
|
||
|
||
# x = Vendor() | ||
# print(x.inventory) | ||
|
||
# y = Vendor([item1]) | ||
# print(y.inventory) | ||
|
||
# x.add(1) | ||
# print(x.inventory) | ||
|
||
# print (x.remove(3)) | ||
|
||
# if x.remove(1): | ||
# print("remove 1") | ||
|
||
# y.get_by_category("jacket") | ||
# print(y.get_by_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.
Just consider removing the commented code prior to submitting.
# if __name__ == "__main__": | |
# from item import Item | |
# item1 = Item("jacket") | |
# x = Vendor() | |
# print(x.inventory) | |
# y = Vendor([item1]) | |
# print(y.inventory) | |
# x.add(1) | |
# print(x.inventory) | |
# print (x.remove(3)) | |
# if x.remove(1): | |
# print("remove 1") | |
# y.get_by_category("jacket") | |
# print(y.get_by_category) |
No description provided.