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

andres rivera
andres rivera
1,009 Points

name = "andres" subject = 'Treehouse loves {}' subject.format(name) dont know what i am doing wrong please help

this is for using the .format method and im doing everything i learn here and dont know what im doing wrong, can someone tell me how to do it right please?

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

2 Answers

It looks like there's a space inside the curly braces on line 2. It should be: subject = 'Treehouse loves {}'

Hey andres! You have left a space between your curly braces. And secondly you should format directly on the string.

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