Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSebastiaan van Vugt
Python Development Techdegree Graduate 13,554 Pointsprice setter not accepted
I'm not able to get the assignment accepted even though I'm pretty sure I have the right answer.
@price.setter
def price(self, np):
self._price = np
The above should simply reset the "_price" to the "np" (new price). Did I overlook something? Thank you for any help.
class Product:
_price = 0.0
tax_rate = 0.12
def __init__(self, base_price):
self._price = base_price
@property
def price(self):
return self._price + (self._price * self.tax_rate)
@price.setter
def price(self, np):
self._price = np
1 Answer
Steven Parker
231,269 PointsYour setter code is fine, but it looks like somehow the "class" line at the very top got indented by one space.
Remove the stray space and you should pass the challenge.