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 trialOszkár Fehér
Treehouse Project ReviewerI tried this code and i don't realize what is wrong.
Somebody please can explain
class RaceCar:
color = 'red'
fuel_remaining = 100
laps = 10
def __init__(self, color, fuel_remaining, laps):
self.color = color
self.fuel_remaining = fuel_remaining
self.laps = laps
def run_lap(self, length):
self.fuel_remaining -= length*0.125
self.laps += 1
Oszkár Fehér
Treehouse Project Reviewerthe question before asket the laps to be created, it's tru just with 0 value. the **kwargs it should not be there, the quiz sepicify it. I passed this quiz already days ago, i had to create inside the init the laps attribute, self.laps = 0. thank you anyway that you answered me
Julio Garcia
1,944 PointsJulio Garcia
1,944 Pointsfirst of all, the description of the task say that color and fuel_remaining are attributes of the class, yo don't need to create the variable and asign something you need to have that attributes only in the init method
next the problem say that you need to set the variable laps = 0
another thing yo don't need to make and instance attribute of laps because to asign already the value, and one thing that also is missing in your code, is that you need to pass in the instance method **kwargs and make the setattr function to receive anything else that is pass when you make the instance of the class.
hope you understand what i'm traying to say, i don't now yet how to upload the and image to explain better all that