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 Instant Objects Master Class

tomtrnka
tomtrnka
9,780 Points

Cant find the error ://

class RaceCar:

    def __init__(self, laps, color, fuel_remaining, **kwargs):
        self.laps = laps
        self.color = color
        self.fuel_remaining = fuel_remaining
        for key, value in kwargs.items():
            setattr(self, key, value)

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

Hey guys. I had step 1 and step 2 without error and inside this step 3 I was just supposed to move the attribute "laps"from class inside the init method. I did that, and I assigned it to self.laps.

But it keeps popping error and there is no way to debug this here :/ pls help :))

1 Answer

Michael Hulet
Michael Hulet
47,912 Points

This challenge isn't asking you to add it as an argument to your __init__. Instead, all you need to do is always assign it to 0, but in your __init__ method (kinda like you're already doing, but with a parameter 😉)