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 Python Basics (2015) Python Data Types String Formatting

I am not sure what I am doing wrong? subject="Treehouse loves{}" .format(name)

It worked in workspace

strings.py
name="Ashton"
subject="Treehouse loves {}." .format(name)

2 Answers

The string must be exactly the same as the challenge

"Treehouse loves {}"
Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

You have a space between the end of your string and the dot for the format method. Take that out. Extra spaces like that will cause things to not work.

I tried this challenge with this code and it passed

name="Ashton"
subject="Treehouse loves {}" .format(name)

And with this code did not pass

name="Ashton"
subject="Treehouse loves {}.".format(name)

Bummer! Be sure to use the {} placeholder and the .format() method. Why?

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

It was because of the period inside the quotes. I've changed it now, though, so the period shouldn't matter.