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

Heather Gilchrist
Heather Gilchrist
4,691 Points

Using .format() on the string "Treehouse Loves" does not work. What am I doing wrong?

All three of these are giving me the error to be sure to use {} and the .format() function. but even when i execute this i get no errors (on the last lines of code). I am stumped as to what I am doing wrong.

My original code is as follows:

name = "Heather"

subject = "Treehouse Loves {}.".format(name)

then I tried:

name = "Heather"

subject = "Treehouse Loves {}." + .format(name)

and my final attempt:

name = "Heather"

subject = "Treehouse Loves {}."

print(subject.format(name))

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

You are so close! And here's where challenges get picky... even down to capitalization. You capitalized the "L" in "Loves". It wants lower-case "loves" and no period at the end. Here... take a look at what they want:

name = "Heather"

subject = "Treehouse loves {}".format(name)
Heather Gilchrist
Heather Gilchrist
4,691 Points

oy vey! thank you. I was going to start pulling hair out! At least I did it right the first time (with exceptions to formatting of the string value.)

Thanks so much! That worked!

Ramesh Gopal
Ramesh Gopal
694 Points

I was stuck here to. Thanks to the brief stall, I can move right along.