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 trialTurner Atteberry
163 PointsI'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?
Gerald Wells
12,763 PointsDid that solve your issue?
3 Answers
Steven Parker
230,929 PointsWithout a link to the challenge, this is a bit of a guess...
But if I recall how that challenge worked, it wanted you to assign the formatted string to the subject variable.
It did not want you to print anything.
Another hint: you can use format directly on the string that has the {}'s.
Turner Atteberry
163 Pointshttps://teamtreehouse.com/library/python-basics/python-data-types/string-formatting challenge 2 is giving me the trouble
Gerald Wells
12,763 PointsPlease include a link to the challenge.
Turner Atteberry
163 Pointsjust added it
Gerald Wells
12,763 PointsOkay 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.
Turner Atteberry
163 PointsTurner Atteberry
163 Pointshttps://teamtreehouse.com/library/python-basics/python-data-types/string-formatting