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

RaceCar task 3 'Bummer' error

I am working on task 3 of the Object-Oriented section of Python. I am working on the RaceCar class, task 3 where they ask to initialize the laps inside the init method. I did the following but I am getting the 'Bummer: Try Again' error. Any help?

class RaceCar():

    def __init__(self, color, fuel_remaining, **kwargs):
        self.color = color
        self.fuel_remaining = fuel_remaining
        self.laps = 0

        for key, value in kwargs.items():
            setattr(self, key, value)

    def run_lap(self, length):
        self.fuel_remaining -= length*0.125
        self.laps += 1

1 Answer

Steven Parker
Steven Parker
229,644 Points

This code looks OK to me. So I tried pasting it directly into the challenge and it passed all 3 tasks!

Try again?

Note: I had to make some assumptions about indentation since the code shown above isn't formatted for markdown. So there could be an issue not visible here.

Use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:
Or watch this video on code formatting.

I edited my question, thanks for the Markdown tips. I still can't find my error and my indentation looks right, especially since the other two tasks worked. A bug in the system maybe?

Steven Parker
Steven Parker
229,644 Points

Just to be sure, since you didn't provide a link, I'm testing this in the Master Class challenge.

I pasted it in again, this time with no changes, and it still passed all 3 tasks.

Unless you're working on a different challenge, this might be an issue for the Support folks.

I restarted my computer and now it is working.... thanks for your help though!