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 trialMikkel Bielefeldt
3,227 PointsI don't see what's wrong
Not sure what's wrong here, I'm looking back and fourth on the video, and the code from last video, but I guess it's not as simple as I want it to be? Please help
class Rectangle:
def __init__(self, width, length):
self.width = width
self.length = length
@area
def __area__(self):
return self.width * self.length
1 Answer
Steven Parker
231,269 PointsYou're pretty close, but instead of the property name, the decorator should just be the word "@property
".
And in the definition itself, the property name doesn't need to be enclosed in double underscores. That's the convention for "magic" methods that are generally not invoked directly, such as __init__
there.
Mikkel Bielefeldt
3,227 PointsMikkel Bielefeldt
3,227 PointsTried to do it again, but it still says try again.
Steven Parker
231,269 PointsSteven Parker
231,269 PointsThat looks correct. Check the indentation in case it has mixed tabs and spaces, that's one possible problem that wouldn't show up here.
If that's not it, try restarting your browser.