Python Python Basics (2015) Python Data Types String Formatting

Did not understand what to do?

When I run in the workspace the code is working.

strings.py
name = "Can"

subject = "Treehouse loves {}."

subject.format(name)

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 143,684 Points

Hi Can,

While your code is syntactically correct and will produce the correct output, it is not what the challenge is asking for. Instructions are very specific in Treehouse challenges and must be followed exactly, or the task will result in the Bummer!.
Here the instruction explicitly state to:

use .format() on the string "Treehouse loves {}"

But you are using the format() method on the variable storing the string and not on the string itself. If you just delete your last line of code and do the format() right on the string, the task will pass.

It's a good thing to remember how picky and specific instruction are for future challenges!

Other than that... Nice work! :)

:dizzy: