-
Notifications
You must be signed in to change notification settings - Fork 94
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
base: master
Are you sure you want to change the base?
Nicole W : Maple #91
Conversation
self.category = category | ||
self.condition = condition |
There was a problem hiding this comment.
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()
self.category = category | |
self.condition = condition | |
super().__init__(category="Clothing",condition) |
self.category = category | ||
self.condition = condition |
There was a problem hiding this comment.
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()
self.category = category | ||
self.condition = condition |
There was a problem hiding this comment.
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()
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 |
There was a problem hiding this comment.
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
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): |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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=""): |
There was a problem hiding this comment.
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()
Great job Nicole! Your code was clear and readable. I added some comments on refactoring a few functions. |
No description provided.