Skip to content
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

Nicole W : Maple #91

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

Nicole W : Maple #91

wants to merge 2 commits into from

Conversation

N-Washington
Copy link

No description provided.

Comment on lines +5 to +6
self.category = category
self.condition = condition
Copy link

Choose a reason for hiding this comment

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

You can use inheritance here by invoking super()

Suggested change
self.category = category
self.condition = condition
super().__init__(category="Clothing",condition)

Comment on lines +6 to +7
self.category = category
self.condition = condition
Copy link

Choose a reason for hiding this comment

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

You can use inheritance here by invoking super()

Comment on lines +6 to +7
self.category = category
self.condition = condition
Copy link

Choose a reason for hiding this comment

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

You can use inheritance here by invoking super()

Comment on lines +13 to +26
condition = self.condition
if condition >= 0 and condition < 1:
description = "yikes,raggedy, on its last leg"
if condition >= 1 and condition < 2:
description = "eek,heavy use,'rough around the edges'"
if condition >= 2 and condition < 3:
description = "eh,well used"
if condition >= 3 and condition < 4:
description = "ok,expected wear and tear"
if condition >= 4 and condition < 5:
description = "good,light use"
if condition == 5:
description = "superb,outstanding,like new"
return description
Copy link

Choose a reason for hiding this comment

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

Using ranges was a great approach and I love the descriptions. Here is a suggestion to use less lines of code

Suggested change
condition = self.condition
if condition >= 0 and condition < 1:
description = "yikes,raggedy, on its last leg"
if condition >= 1 and condition < 2:
description = "eek,heavy use,'rough around the edges'"
if condition >= 2 and condition < 3:
description = "eh,well used"
if condition >= 3 and condition < 4:
description = "ok,expected wear and tear"
if condition >= 4 and condition < 5:
description = "good,light use"
if condition == 5:
description = "superb,outstanding,like new"
return description
if self.condition > 4.0:
return "Very good condition"
elif 3.0 < self.condition <= 4.0:
return "Pretty good condition"
elif 2.0 < self.condition <= 3.0:
return "Noticeable wear and tear"
else:
return "Fashionably rustic"

return False

#Wave 02
def get_by_category(self,category):
Copy link

Choose a reason for hiding this comment

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

💃🏽

output: returns True: if items in list and swapped
else: returns False
'''
if my_item in self.inventory and their_item in other_vendor.inventory:
Copy link

Choose a reason for hiding this comment

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

💃🏽

'''
if bool(self.inventory) == False or bool(other_vendor.inventory) == False:
return False
else:
Copy link

Choose a reason for hiding this comment

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

You already have a function that will do this work for you! swap_items() can be called here and then you would pass in the first item of the vender and the other vendor as arguments
return self.swap_items(other, self.inventory[0], other.inventory[0])

return None


def swap_best_by_category(self,other = "", my_priority= "",their_priority=""):
Copy link

Choose a reason for hiding this comment

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

great use of swap_items()

@tgoslee
Copy link

tgoslee commented Oct 8, 2021

Great job Nicole! Your code was clear and readable. I added some comments on refactoring a few functions.

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