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

Challenge question 2 of 3

I have tried various way to solve this. It keep saying "try again"... What did I do wrong here?

Thank you

racecar.py
class RaceCar:
    self.laps = 0
    def __init__(self, color, fuel_remaining, **kwargs):
        self.color = color
        self.fuel_remaining = fuel_remaining 
        for k ,v in kwargs.items():
            setattr(self, k, v)
    def run_lap(self, length):
        self.length = self.fuel_remaining - length * 0.125
        laps =+ 1

1 Answer

Christopher Shaw
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Shaw
Python Web Development Techdegree Graduate 58,248 Points

Good day, you are on the right track, but firstly self.laps = 0 should just be laps = 0 This is a syntax error that will give you the error Bummer .....

You will then get a new error Did you adjust the fuel_remaining attribute? as self.length = ..... should be self.fuel_remaining = ....

Lastly, it will ask if you have incremented the laps. Here it should be self.laps = self.laps + 1