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!
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
Younghoo ParkCourses Plus Student 1,046 Points
Challenge question 2 of 3
I have tried various way to solve this. It keep saying "try again"... What did I do wrong here?
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
Christopher ShawPython Web Development Techdegree Graduate 58,236 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