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

I'm stuck on the final strings code challenge. cant figure out what I'm doing wrong and ideas?

name = "turner" subject = "treehouse loves {} " print(subject.format(name))

But this does not work I've tried putting "" around name I have tried everything all it says is error error error any ideas?

Did that solve your issue?

3 Answers

Steven Parker
Steven Parker
229,644 Points

But if I recall how that challenge worked, it wanted you to assign the formatted string to the subject variable.

:point_right: It did not want you to print anything.

Another hint: you can use format directly on the string that has the {}'s.

Please include a link to the challenge.

just added it

Okay so the problem isn't requesting you to print anything. The problem states

"now use .format() on the string "Treehouse loves {}" to put your name into the placeholder. Assign this to the variable subject again."

so your code would look like this:

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

You are printing the solution which is the problem, it is simply asking you to create a variable "subject" and assign it the value "Treehouse loves" and format that string with the variable name.