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

The quiz says i got the answer wrong, but when i did it in workspace it came out right. What am I missing?

using .format to plug in the name variable, I typed subject.format(name) When i did this in workspace it entered my name into the {} and came up 'Treehouse loves Tess'. When i entered subject.format(name) into the quiz it said that was wrong. So what is it the quiz is actually asking me to do?

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

1 Answer

billy mercier
billy mercier
6,259 Points

They want you to .format(name) after the string. Also remove the (). When giving a string to a variable you don't want to give it (), unless you want to make a tuple....

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