Skip to content

Vivian Zhu, C18 Cheetahs #84

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

viviantomato
Copy link

No description provided.

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! There are comments below about how to better use parent classes. Please be sure to read that. For commits, it would be good if your commits were more descriptive. Instead of writing about which wave you completed, consider messages like "Created Item class" or "Added swap_items function to Vendor class".

from swap_meet.item import Item

class Clothing(Item):

Choose a reason for hiding this comment

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

Great start on adding Item as the parent class for Clothing! However, you are not fully using all of the things that parent classes offer. Rather than setting category and condition in the child class, you can send those values to the super class and it can be set there for you. You would use this line of code:

super().__init__("Clothing", condition)

and then you could remove lines 7 and 8. This works for Decor and Electronics as well!

Comment on lines +6 to +7
category = ""

Choose a reason for hiding this comment

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

You do not need to use None if the field is a string! Strings are immutable, so you can have the default be "". You want to use None for things that are mutable, like lists or dictionaries.

if self.condition <= 1:
return "Uhhh"
elif self.condition <= 2 and self.condition >= 1:

Choose a reason for hiding this comment

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

Since you use elif, you can make your statements cleaner. For instance, you don't need to use >= 1 here because you know in order to get here the condition has to be higher than 1 because it skipped the first if.


# Wave 1
def __init__(self, inventory = None):

Choose a reason for hiding this comment

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

Excellent!

self.inventory = inventory

def add(self, add_item):

Choose a reason for hiding this comment

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

Excellent!

Comment on lines +38 to +40
assert item_a not in items
assert item_b not in items
assert item_c 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 are actually not needed. Since the first assert tells us that there is nothing in the list, we don't need to check if these individual items are in the list.

Comment on lines +79 to +87
assert result == 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 in jesse.inventory
assert item_f in tai.inventory
assert item_d in jesse.inventory
assert item_e 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 +114 to +122
assert result == 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_f in tai.inventory
assert item_d in jesse.inventory
assert item_e 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 +200 to +208
assert not 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_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 +234 to +242
assert not 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_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