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

Python Basics: Using .format

name="noel" subject="Treehouse loves{}" subject.format(name) shouldn't this come out as Treehouse loves noel?

strings.py
name="noel"
subject= "Treehouse loves {}"
subject.format(name)

1 Answer

Idan shami
Idan shami
13,251 Points

Hi! the challenge won't take your answer because you didn't need to write this line:

subject.format(name)

the format method needs to go in the subject, like this:

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

sorry for my bad English (: I hope you understand it.

ooooh, ok got it thanks!