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

Race Car 2/3: What's wrong with my code? I've run this code in Visual Studio and it didn't show me any bugs.

This error message I get is: "Did you adjust the fuel_remaining variable?"

Which I don't know how my method isn't doing that since I'm calling the fuel_remaining variable and adjusting it by the length*.0125 for reach time the function is called.

I'm not sure what I'm not seeing.

Thanks to anyone in advance for pointing me in the right direction.

racecar.py
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.length = length
        self.fuel_remaining -= (self.length*.0125)
        self.laps += 1

2 Answers

Hi Duane

You have a small typo here :

self.fuel_remaining -= (self.length*.0125)

It should be

self.fuel_remaining -= (self.length*0.125)

So replace .0125 with 0.125 and all should be good!

Wow, God bless you my good friend. I swear it would have been a month before I realized that I even made that typo and would have been through a ton of different iterations before I decided that was the big issue.

Happy to help, Duane! Good luck with your studies! :-)