-
Notifications
You must be signed in to change notification settings - Fork 113
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
Sea Turtles- Theresa D. #99
base: master
Are you sure you want to change the base?
Conversation
|
||
def __str__(self): | ||
return (f"Something to decorate your space.") |
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 don't have to use a f string because you are just returning the string
return "Something to decorate your space"
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 job Theresa ! I left some comments on your project on things you did well and suggestions for refactoring. Let me know if you have any questions.
|
||
|
||
def __str__(self): | ||
return (f"A gadget full of buttons and secrets.") |
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.
return (f"A gadget full of buttons and secrets.") | |
return "A gadget full of buttons and secrets." |
|
||
def __str__(self): | ||
return (f"The finest clothing you could wear.") |
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.
return (f"The finest clothing you could wear.") | |
return "The finest clothing you could wear." |
return f"Hello World!" | ||
|
||
def condition_description(self): |
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.
Good job making an if/elif statement here. I would look into how you could possibly improve this block of code by using other data structures.
coat_1 = Item(category="clothing") | ||
hat_1 = Item(category="clothing") |
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.
remove test code/debugging code when you are finished and before submitting final code.
self.inventory.remove(my_item) | ||
vendor.inventory.append(my_item) | ||
vendor.inventory.remove(their_item) |
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 the instance methods you already created so self.add(their_item)
and self.remove(my_item)
return False | ||
|
||
def swap_first_item(self,vendor): |
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.
how could you use swap_items()
here to reduce redundant code?
my_best = self.get_best_by_category(their_priority) | ||
if my_best == None: | ||
return False | ||
their_best = other.get_best_by_category(my_priority) | ||
if their_best == None: | ||
return False | ||
return self.swap_items(other, my_best, their_best) |
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.
Here is a suggestion for cleaning up your code slightly.
def swap_best_by_category(self, other, my_priority, their_priority): | |
my_best = self.get_best_by_category(their_priority) | |
if my_best == None: | |
return False | |
their_best = other.get_best_by_category(my_priority) | |
if their_best == None: | |
return False | |
return self.swap_items(other, my_best, their_best) | |
def swap_best_by_category(self, other, my_priority, their_priority): | |
my_best = self.get_best_by_category(their_priority) | |
their_best = other.get_best_by_category(my_priority) | |
if not my_best or not their_best: | |
return False | |
return self.swap_items(other, my_best, their_best) |
No description provided.