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

.format to include a string

In this task, you are asked to use .format on greeting to include your name. In this case, my code will not run but it seems correct to me.

What am I missing / doing wrong? Seems to run in IDLE.

strings.py
name = "shane"
greeting = "Treehouse loves {}"
greeting.format(name)

I should add that, this seems to be a common issue - code running in the treehouse environment that is. The overwhelming lack of support is astounding.

name = "shane"
greeting = "Treehouse loves {}"
greeting.format(name)

2 Answers

Your code is close. After you set the variable 'name' equal to a name you then set 'subject' equal to the string "Treehouse loves {}".format(name)

I should pay attention :)

These code challenges are designed to look for specific output from the students; that's why it is important to pay close attention to the details at the top of your code challenge.