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

Jasmin Mattiaccio
PLUS
Jasmin Mattiaccio
Courses Plus Student 3,131 Points

hello, pretty sure i've done this correctly yet it wont let me pass :(

Dont know why it is marking my code as wrong.... unless it is wrong??

strings.py
name = 'Jasmin'
subject = "Treehouse loves {}" .format(name)
dublinruncommutr
dublinruncommutr
5,944 Points

Hi Jasmin - take a look at your last line of code - it appears you have some white space between the string you are trying to format and the method call to .format() you are trying to make - syntactically this will work but less readable.

This exercise requires a print output to pass. Reexamine your code and I'm sure you'll see where you might be able to print() your formatted string.

Steven Parker
Steven Parker
229,644 Points

The instructions explicitly say: "You do not need to print() anything."

2 Answers

Steven Parker
Steven Parker
229,644 Points

Readability aside, the space between the template string and the ".format" is allowed by the language syntax, but the challenge doesn't accept it.

You might want to report this as a bug to the Support staff.