Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Shane SmithPython Development Techdegree Student 2,550 Points
What am I missing?!?
The preview code function is just saying "bummer try again" and not throwing an error so I am unsure of where my mistake is. Thank you in advance!
class RaceCar: laps = 0 def __init__(self, color, fuel_reamaining, **kwargs): self.color = color self.fuel_remaining = fuel_reamaining for key, value in kwargs.items(): setattr(self, key, value) def run_lap(self, length): self.length = length fuel_remaining = fuel_remaining - (self.length * .125) laps += 1
Jennifer NordellTreehouse Teacher
Hi there, Shane Smith! The issue here is that
fuel_remaining is undefined. It doesn't exist in the context of that method. What you're looking for is
self.fuel_remaining Also, you do not need to make a new attribute named
self.length. We're passing in the length to the method so you could do
self.fuel_remaining -= length * .125.
Hope this helps!