Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
215,958 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.