-
Notifications
You must be signed in to change notification settings - Fork 110
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
Panthers - Cintia/Ryan #90
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.
Congratulations on completing this project Cintia and Ryan! There's some impressive code in here, and it's very clean and easy to read. Great use of helper methods in the Vendor class! Excellent work using inheritance to create the children classes!
# creates class/category Clothing using class Item | ||
# stringifies Clothing | ||
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.
Amazing work completing your project yall! This inheritance is sweet and the comment clearly explains what your method's objective is 💯
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.
Excellent work with these default arguments
# creates class/category Decor using class Item | ||
# stringifies Decor | ||
class Decor(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.
👍🏾
from swap_meet.item import Item | ||
# creates class/category Electronics using class Item | ||
# stringifies Electronics | ||
class Electronics(Item): | ||
def __init__(self, category="Electronics", condition=0): | ||
self.category = category | ||
self.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.
✅
category = "" | ||
self.category = 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.
Good job using this default parameter of None. None is often used as a default argument value in Python because it allows us to call the function without providing a value for an argument that isn't required on each function invocation. Here's the article I referenced: https://bobbyhadz.com/blog/python-using-none-as-default-argument#:~:text=None%20is%20often%20used%20as,for%20list%20and%20dict%20arguments.
You could refactor this to a shorthand (one-liner): self.category = category if category is not None else ""
if self.condition == 0: | ||
return "Horrible Condition >:(" | ||
elif self.condition == 1: | ||
return "Heavily Used :(" | ||
elif self.condition == 2: | ||
return "So-So condition :/" | ||
elif self.condition == 3: | ||
return "Decent :|" | ||
elif self.condition == 4: | ||
return "Gently Used :)" | ||
elif self.condition == 5: | ||
return "Like New! >:)" |
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 way to implement your description! It uses conditional flow pretty well
if not category: | ||
return None | ||
matching_items = [] | ||
for item in self.inventory: | ||
if item.category == category: | ||
matching_items.append(item) | ||
return matching_items |
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 job!
if my_item in self.inventory and their_item in friend.inventory: | ||
self.add(their_item) | ||
friend.add(my_item) | ||
self.remove(my_item) | ||
friend.remove(their_item) | ||
return True | ||
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 looks good to me!
inventory = self.get_by_category(category) | ||
if not inventory: | ||
return None | ||
highest = 0 | ||
best_item = None | ||
for item in inventory: | ||
if item.condition > highest: | ||
highest = item.condition | ||
best_item = item | ||
return best_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.
Nice job connecting what you learned from the Problem Solving Exercise 👍🏾
assert result == False | ||
|
||
assert len(vendor.inventory) == 3 | ||
assert "a" in vendor.inventory | ||
assert "b" in vendor.inventory | ||
assert "c" in vendor.inventory |
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 check the result more pythonically but checking for the falseyness!
assert result | ||
assert len(tai.inventory) == 3 | ||
assert len(jesse.inventory) == 3 | ||
|
||
assert item_a in tai.inventory | ||
assert item_b in tai.inventory | ||
assert item_f in tai.inventory | ||
assert item_c in jesse.inventory | ||
assert item_d in jesse.inventory | ||
assert item_e in jesse.inventory |
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.