Outputs "None" after my print statement

class Car(object):
  condition = "new"
  def __init__(self, model, color, mpg):
    self.model = model
    self.color = color
    self.mpg   = mpg
  def display_car(self):
    print "This is a %s %s with %s MPG." \
    %(self.model, self.color, self.mpg)

my_car = Car("DeLorean", "silver", 88)

print my_car.display_car()

The output in the console reads:

This is a DeLorean silver with 88 MPG.

The code checker isn’t accepting this as a valid solution.


Console behavior that we may delightfully ignore.

Given that our call to the start the ball rolling is a function the console is going to want a response to output when all is said and done. Given that the last executed function has no return value, that output is None, which is perfectly normal. So long as the output preceding it is what the user expects, we’re on the mark.


Is there a way I can skip this lesson?


Try silver Delorean, first, then give us another look.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.