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 trialDuane Smith
1,919 PointsRace 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.
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
Ave Nurme
20,907 PointsHi 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!
Ave Nurme
20,907 PointsHappy to help, Duane! Good luck with your studies! :-)
Duane Smith
1,919 PointsDuane Smith
1,919 PointsWow, 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.