Conversation
goeunpark
left a comment
There was a problem hiding this comment.
Great work, Jessica! 🎉
I'm so proud of how far you've come! Your tests pass, your classes look solid, your commit messages are frequent, and you are passing data through functions like a pro. This project is a well-deserved Green. 🟢
One small thing I wanted to point your attention towards was around consistent spacing. Generally, there should be just one newline at the end of a function and at the end of the file. Inside a function, I try to not create an empty line unless it really does help with organizing chunks of my code. For example, looking at your vendor.py, the code in get_best_by_category() feels really tight and concise while swap_items() just above is has good code, but the spacing makes it feel longer that necessary. This is also a skill that you develop over time; let me know if you'd like me to elaborate on this matter!
Overall, great work! Keep it up! ⭐
| from swap_meet.item import Item | ||
|
|
||
| class Clothing(Item): | ||
| def __init__(self, condition= 0 ): |
There was a problem hiding this comment.
Make sure to clean up your code before submission with proper spaces (or in this case, no spaces) between the values before and after the =. Clean code goes a long way and I found this section in the PEP8 style convention really useful!
| category = "Clothing" | ||
| super().__init__(category = category, condition = condition) |
There was a problem hiding this comment.
We can shorten L5-6 to one line by saying:
super().__init__(category="Clothing", condition=condition)
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
🔥 Remove any unnecessary newlines at the end of your files!
| pass No newline at end of file | ||
| from swap_meet.item import Item | ||
|
|
||
| class Decor(Item): |
There was a problem hiding this comment.
Flawless case of inheritance! Great work!
| from swap_meet.item import Item | ||
|
|
||
|
|
||
| class Electronics(Item): |
| another_item = another_vendor.inventory[0] | ||
| my_item = self.inventory[0] | ||
|
|
||
| self.swap_items(another_vendor, my_item, another_item) |
| if item.category == category: | ||
| if item.condition > best_condition_rating: |
There was a problem hiding this comment.
We can also combine this into:
if item.category == category and item.condition > best_condition_rating:
| other_vendor_swap_item = other.get_best_by_category(my_priority) | ||
|
|
||
|
|
||
| if my_swap_item is not None and other_vendor_swap_item is not None: |
There was a problem hiding this comment.
We can also shorten this to the following because the values themselves will evaluate to Truthy:
if my_swap_item and other_vendor_swap_item
| assert item1 not in vendor.inventory | ||
| assert remove_result == item1 | ||
|
|
||
| print(f"This is vendor inventory{vendor.inventory}") |
There was a problem hiding this comment.
Remember to remove your debugging print statements after you finished using them! 😉
| assert len(items) == 0 | ||
| assert item_a not in items | ||
| assert item_b not in items | ||
| assert item_c not in items |
No description provided.