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 trialDavid Albers
8,895 PointsIssues with the String Formatting challenge in the python basics course.
I have been doing the challenge at this location:
https://teamtreehouse.com/library/python-basics/python-data-types/string-formatting
Using the code that will be attached.
I have checked the code so many times that I have lost count and it looks exactly like what the instructor used in the training video. I have even used the workspaces console to run the code and it works just fine. However, every time I have the challenge check my code it gives me an error message
Bummer! Be sure to use the {}
placeholder and the .format()
method.
name = "David"
subject = "Treehouse loves {}"
subject.format(name)
2 Answers
Saman Bir
Courses Plus Student 724 Pointstry subject = "Treehouse Love {}".format(name)
Saman Bir
Courses Plus Student 724 PointsI think you use the .format() usually in the same line with {}.
It is like saying I want to fill {} with .format(you name what you want to fill it with)
David Albers
8,895 PointsDavid Albers
8,895 PointsThank you so Much! So I am assuming, I could only right it the way I did, if I were using it in something like the print function, which is why it worked on the console correctly?