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 trialdrew mullen
1,555 Pointsracecar.py challenge 2 - "bummer: try again"
really confused why this isnt working. can anyone advise?
class RaceCar:
laps = 0
def __init__(self, color, fuel_remaining, **kwargs):
self.color = color
self.fuel_remaining = fuel_remaining
for key, value in kwargs.items():
setattr(self, key, value)
def run_lap(self, length):
self.fuel_remaining -= (length * 0.125)
self.laps += 1
3 Answers
drew mullen
1,555 Pointsafter copying and pasting into an IDE, i think there are hidden characters screwing with the white spacing. literally the code is fine and the spacing APPEARS to be fine but there are hidden characters that are failing the code.
can the devs at team treehouse please address this infuriating issue. or at the very least, give us a real error message
Steven Parker
231,248 PointsYour code looks good to me.
So I tried pasting it directly into the challenge, and it passed task 1 and task 2!
If you're getting a "false failure", I've heard that restarting your browser can help.
Dave Faliskie
17,793 Pointslooks like you just need to add the laps attribute to your class, in the init
self.laps = 0
Steven Parker
231,248 PointsThat's task 3, he's still on task 2. If it were task 3 the error message would be different.
Steven Parker
231,248 PointsSteven Parker
231,248 PointsI'm not sure what you mean. I copy/pasted your code just as is and it passed.
drew mullen
1,555 Pointsdrew mullen
1,555 PointsSteven Parker this is from my execution after just copying and pasting. After seeing this error i removed all spacing (and from vscode i can tell its visually 2 tabs) and then retabbed, boom worked.
ive actually seen this issue before too. its probably because im using chrome os and im guessing they dont test much on chrome os yet