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

Joseph Kumar
Joseph Kumar
1,930 Points

Is this placeholder format incorrect: name = "Joseph" subject = "Treehouse loves {}" print(subject.format(name))

The task was to get hold of my name in the placeholder and ensure that the output is "Treehouse loves Joseph"

strings.py
name = "Joseph"
subject = "Treehouse loves {}"
print(subject.format(name))
Andrew Rady
Andrew Rady
20,880 Points

Hey Joseph,

The code challenge is looking for you to use the .format on the subject variable and then print just the variable.

Here is what my code looks like

name = 'Andy'
subject = 'Treehouse loves {}'.format(name)
print(subject)

2 Answers

Andrew Rady
Andrew Rady
20,880 Points

Hey Joseph,

The code challenge is looking for you to use the .format on the subject variable and then print just the variable.

Here is what my code looks like

name = 'Andy'
subject = 'Treehouse loves {}'.format(name)
print(subject)
Joseph Kumar
Joseph Kumar
1,930 Points

Thanks for the correction Andrew Rady. :)