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!

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

Norman OBrient
PLUS
Norman OBrient
Courses Plus Student 288 Points

String formatting using the .format method

Need help on string formatting exercise in Python Basics using the .format method. I cannot get the challenge to pass me on even though I have successfully achieved the task in the console. Here is the code I wrote:

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

I also tried the following code which worked but the challenge did not accept

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

Please help - thank you!

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

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,854 Points

Hey Norman,

If I copy and paste the first bit of code you provided, the challenge passes with no problems:

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

In the code snippet that is provided from the challenge (the one that is formatted as a code block in your post), you have a Upper-cased "N" in the variable name, and that would cause the Bummer!

Keep Coding! :dizzy: