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

Aaron Schokman
PLUS
Aaron Schokman
Courses Plus Student 520 Points

Bit confused why this isn't correct....

Just a bit confused why this isn't correct/what the correct answer is.

Thanks in advance :)

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

1 Answer

Hi there,

You're really close - basically, the issue is that this line:

subject.format(name)

doesn't actually save the formatted value to the 'subject' variable, which is what the challenge is checking. To do that, it would have to be:

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

The challenge doesn't like this, though - just thought I'd mention it because that kind of thing will work in the python shell, for example. The challenge is looking for you to do it on the same line, which would look like this:

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

Hope this helps!