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

Tarique Hasheem
Tarique Hasheem
434 Points

py3.shell on Mac prints Treehouse loves Tes [print("string".format(name))] however session keeps failing

I've made many attempts to figure out why challenge task 2 of 2 fails. On a Mac I'm able to generate Treehouse loves Tes based on [>name = 'Tes' >print('Treehouse loves {}'.format(name)).

strings.py
name = 'Tes'


print("Treehouse loves {}".format(name))

1 Answer

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

Hi there.

While your code indeed outputs Treehouse loves Tes, that's not what the challenge is asking. You're supposed to assign the String to the variable named subject.

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

That's all you have to do to pass the challenge.