Conversation
…ection between the string inside the self.inventory and the attribute category in Item class
…by using parameter_name.attribute_name
…e specific index 0. After assign the index 0 to a new variable, the problem solved.
…ry function, wrongly put my_priority in the self.get_best_by_category function
nancy-harris
left a comment
There was a problem hiding this comment.
Excellent job! Your code overall is great! There are some comments about places where the code could be DRY-ed up. For commits, it would be a good idea to commit more often! It would also be great if the commit messages could focus on what changes were made to the code. Instead of messages about being stuck, it would be good to have something like "Created Item class" or "Added swap_item function".
| from swap_meet.item import Item | ||
|
|
||
| class Clothing(Item): | ||
| def __init__(self, category = "Clothing", condition = 0): |
There was a problem hiding this comment.
Great job! We actually don't want to have category in the __init__ function. Since Clothing objects should always have "Clothing" as the category we do not want to let the user to put in their own information. On line 5 instead of category you can put "Clothing" to pass to the super class.
| pass No newline at end of file | ||
| from swap_meet.item import Item | ||
|
|
||
| class Decor(Item): |
| pass | ||
| from swap_meet.item import Item | ||
|
|
||
| class Electronics(Item): |
|
|
||
| class Item: | ||
| pass No newline at end of file | ||
| def __init__(self, category = None, condition = 0): |
There was a problem hiding this comment.
The default for category can be "" instead of None. We use None for mutable data types like lists or dictionaries. Since string are immutable in Python, we do not need None.
| def __str__(self): | ||
| return "Hello World!" | ||
|
|
||
| def condition_description(self): |
There was a problem hiding this comment.
It looks like you were changing some of the conditions in the if statements, but didn't finish. The logic has some gaps in it. Good start though!
| assert item_a not in items | ||
| assert item_c not in items | ||
| assert item_b not in items |
There was a problem hiding this comment.
Great asserts! These three aren't necessary since the first one tells us there's nothing in the list. We don't need to check each individual item.
| assert result is True | ||
| assert len(tai.inventory) == 3 | ||
| assert len(jesse.inventory) == 3 | ||
| assert item_a in tai.inventory | ||
| assert item_b in tai.inventory | ||
| assert item_c not in tai.inventory | ||
| assert item_f in tai.inventory | ||
| assert item_d in jesse.inventory | ||
| assert item_e in jesse.inventory | ||
| assert item_f not in jesse.inventory | ||
| assert item_c in jesse.inventory |
| assert result is True | ||
| assert len(tai.inventory) == 3 | ||
| assert len(jesse.inventory) == 3 | ||
| assert item_a in tai.inventory | ||
| assert item_b in tai.inventory | ||
| assert item_c not in tai.inventory | ||
| assert item_f in tai.inventory | ||
| assert item_d in jesse.inventory | ||
| assert item_e in jesse.inventory | ||
| assert item_f not in jesse.inventory | ||
| assert item_c in jesse.inventory |
| assert result is False | ||
| assert len(tai.inventory) == 3 | ||
| assert len(jesse.inventory) == 3 | ||
| assert item_a in tai.inventory | ||
| assert item_b in tai.inventory | ||
| assert item_c in tai.inventory | ||
|
|
||
| assert item_d in jesse.inventory | ||
| assert item_e in jesse.inventory | ||
| assert item_f in jesse.inventory |
| assert result is False | ||
| assert len(tai.inventory) == 3 | ||
| assert len(jesse.inventory) == 3 | ||
| assert item_a in tai.inventory | ||
| assert item_b in tai.inventory | ||
| assert item_c in tai.inventory | ||
|
|
||
| assert item_d in jesse.inventory | ||
| assert item_e in jesse.inventory | ||
| assert item_f in jesse.inventory |
No description provided.