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 trial

Python Object-Oriented Python Advanced Objects Proper Properties

Andras Andras
Andras Andras
7,941 Points

Workspace bug - python rectangle.py

Hello,

In the code below one solution has pink "dot" the other solution has white "dot".

White dot is copied from the forum. pink one is my own. It did not pass with the pink.

rectangle.py
class Rectangle:
    def __init__(self, w, l):
        self.w = w
        self.l = l
    @property
    def area(self):
        return self.w*self.1 

    def area(self):
        return self.w*self.l
Andras Andras
Andras Andras
7,941 Points

Okay, so here is not "pink" or "white" (this is an other issue).

So first solution did not pass but second does. The difference is "self.1". Blue vs White. First one is my code the second one is copied from the forum.

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! This is not a bug. You've declared a variable in the parameters named l which is a lower-case L. In the first one, it does not pass because you're trying to access a variable named "1" which is the number one. I know they look similar, but take a closer look. The second one passes because you are now accessing the variable which was defined "l", which I'm guessing stands for "length".

Hope this helps! :sparkles:

Andras Andras
Andras Andras
7,941 Points

Okay, Thanks :) It makes sense!