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

Brian S.
Brian S.
3,176 Points

Am i to print the complete statement after defining the .format? Is this not a 2 part question?

I am defining the subject as subject= 'Treehouse loves {}'... and the name as name = 'brian' Not what sure am I to do with that. I can print it using>>> print(subject.format(name)) , and that works in my console fine, but it seems that is not what the question wants from me. What does it want?

strings.py
>>> subject= 'Treehouse loves {}'
>>> print(subject.format(name))
Treehouse loves brian

1 Answer

Julian Garcia
Julian Garcia
18,380 Points

Hi,

Just rearrange it a little:

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

Hope it help.