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

Bradley Pollard-krigbaum
seal-mask
.a{fill-rule:evenodd;}techdegree
Bradley Pollard-krigbaum
Python Web Development Techdegree Student 2,818 Points

kinda tired, just need a little help getting this ':D

what am I doing wrong?

racecar.py
class RaceCar:
    color = "Blue"
    fuel_remaining = 100
    length = 9
    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, laps):
        return (self.fuel_remaining -= (self.length * 0.125)) and self.laps += 1

1 Answer

Hi there,

Sorry - I just deleted an answer I wrote but I shouldn't have!

The run_laps method doesn't need to return anything. It just sets some values.

Pass in the length and self; laps is on the class so doesn't need passing in. Inside the method, deduct, as you have done, from fuel_remaining and increment laps. I did that on two lines rather than one but if that works for you, then great!

The method needn't return anything - it just amends those values as you have done.

I hope that helps!

Steve.

Cool - glad you got it fixed. :+1: