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 trialmatthew zecchini
10,016 PointsI'm completely stuck on this question, I've been following along just fine. I re-watched the previous video.
Please point me in a direction. Not sure how else to change my code based upon what was shown in the material thanks in advance.
class Rectangle:
def __init__(self, width, length):
self.width = width
self.length = length
@property
def area(self, area):
return self.width * self.height
3 Answers
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsTwo things:
- there's no property called
height
in this class. I think you meanlength
- you're passing in an argument to area called area. You don't need that
These things are easier when you're using your own text editor/IDE and get real, more specific error messages as opposed to just "Bummer!"
matthew zecchini
10,016 PointsFor some reason when I copy pasted the dunders didn't appear. I am using init in the code.
matthew zecchini
10,016 PointsOdd not sure how to type the underscore in the comments here.
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsSorry, just edited my previous comment.
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsIf you wrap your code in triple backticks "```" it will format it as code nicely.
matthew zecchini
10,016 PointsGreat thank you so much. It looks like after I changed the silly mistake of height vs. length my tabs/spacing was still off somehow. Really saved me! Thanks for the quick help.
matthew zecchini
10,016 Pointsmatthew zecchini
10,016 Pointsclass Rectangle: def init(self, width, length): self.width = width self.length = length
@property def area(self): return self.width * self.length
I changed it and also redid the tab/indent but I'm still stuck. Thank you.
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsBrendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsI put in your code with proper indentation and it worked: