Python Python Basics (2015) Python Data Types String Formatting

Tess Morrow
Tess Morrow
213 Points

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,258 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)