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

String Formatting

I have written this code into Workspaces and it has worked, however when I come to do the code challenge, it doesn't pass.

name = "lee"

subject = "treehouse loves {} "

print(subject.format(name))

1 Answer

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

Hi there! While your code may be functional, it doesn't meet the explicit instructions of the challenge. Keep in mind that challenges have very specific requirements and it's always best to try not to do anything they don't ask for. For instance, you're trying to print something and it never asked for that.

Also, your string is incorrect. You've written "treehouse" instead of "Treehouse". The challenge is testing your output and it must be perfect to the letter. This includes capitalization, punctuation, and spacing.

The line you're looking for is:

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

Hope this helps! :sparkles:

Ah thank you Jennifer! It makes perfect sense now.

I'll be sure to check my punctuation and capitalization in future and makes sure I stick to the question requirements.

Thanks for the fast response :)