Skip to content

Miranda - Lion#83

Open
yxzhang88 wants to merge 8 commits intoAda-C18:masterfrom
yxzhang88:master
Open

Miranda - Lion#83
yxzhang88 wants to merge 8 commits intoAda-C18:masterfrom
yxzhang88:master

Conversation

@yxzhang88
Copy link

No description provided.

Miranda added 8 commits October 3, 2022 11:30
…ection between the string inside the self.inventory and the attribute category in Item class
…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
Copy link

@nancy-harris nancy-harris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

pass
from swap_meet.item import Item

class Electronics(Item):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!


class Item:
pass No newline at end of file
def __init__(self, category = None, condition = 0):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Comment on lines +39 to +41
assert item_a not in items
assert item_c not in items
assert item_b not in items

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +80 to +90
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

Comment on lines +128 to +138
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

Comment on lines +224 to +233
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

Comment on lines +268 to +277
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants