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

Daniel Nielsen
Daniel Nielsen
1,241 Points

I literally have no idea what i am doing wrong here.. anyone?

name = "Daniel" subject = "Treehouse loves" subject.format(name)

strings.py
name = "Daniel"
subject = "Treehouse loves" 
subject.format(name)
Daniel Nielsen
Daniel Nielsen
1,241 Points

subject = "Treehouse loves" + {}

thats how it looks

1 Answer

AJ Salmon
AJ Salmon
5,675 Points

I think the question might be a little misleading when it tells you to use 'subject ='. What it's asking here is for you to assign the string "Treehouse loves {}".format(name) to the variable subject. It should look like this:

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

Remember, when using .format(), you need to have curly braces in the string that you're formatting. The argument that you give to .format() (whatever you put in the parentheses after format) will then appear in the string. Hopefully this clears it up! If you have any more questions let me know, I'll answer to the best of my ability :)