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!

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 Python Basics (2015) Python Data Types String Formatting

Python: .FORMAT method usage.

I have tried the string in several ways and I cannot get it to work. What is the answer to this and why?

name = "strong"
subject = ("Treehouse love {}".format("strong"))

2 Answers

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! It was your second attempt in the middle that was correct, with one tiny exception. The string is supposed to be "Treehouse loves", but you wrote "Treehouse love". Remember, these challenges are very strict and your answer must match to the letter. This includes capitalization, spelling, punctuation, and even spacing.

Take a look:

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

You were literally off by one character. I'd say job well done! :sparkles:

name = "strong" subject = ("Treehouse love {}".format("strong"))


name = "strong" subject = "Treehouse love {}".format(name)


name = "strong" subject = "Treehouse love {}".format("strong")