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 Advanced Objects Dream Car

AssertionError: '.' not found in 'my dream car is a mustang' : It looks like your sentence is missing a period (.)

Add a str method to the DreamCar class. In the method, return a string that states the dream car's make and model. The string should look like this: 'My dream car is a Ford Mustang.'

dream_car.py
class DreamCar:
    def __init__(self, make, model="Ford Mustang"):
        self.make = make
        self.model = model
    # insert your code here
    def __str__(self):
        return "My dream car is a {}".format(self.model)

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Shreya Tyagi ! I received your request for assistance. The challenge is correct. You're missing a period in the sentence. It wants a period/full stop as part of the string being returned.

You wrote:

 return "My dream car is a {}".format(self.model)

But you need another full stop immediately after the curly braces:

 return "My dream car is a {}.".format(self.model)

Note that when challenges are asking for strings they are very particular. This includes spelling, punctuation, and even spacing. :smiley:

Hope this helps! :sparkles:

edited for additional information

Note that you will need to format the string with both the make and the model. So just adding the full stop/period won't work. You will need another set of curly braces and one more argument in the .format().