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

Help using the . format method and string

OK, now use .format() on the string "Treehouse loves {}" to put your name into the placeholder. Assign this to the variable subject (so start with subject =).

I'm not sure whats being asked of me above. to my understanding and what would make sense in my head would be as follows: subject = "Treehouse loves{}" print(subject.format('myname'))

1 Answer

The exercise wants you to assign the formatted string to the variable subject, not print it.

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