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

strings are not working here, yet in regular IDE they work

name variable works subject variable works This on my personal IDE works: Name = "blahblah" subject = "treehouse loves + name <<<WORKS HOWEVER! subject="treehouse loves {}" print(subject.format(name)) DOES NOT AT ALLL!

How is this !!!!!!


On workspaces name =" MY " "NAME" name "MY NAME" subject = "Treehouse loves {}" subject "Treehouse loves {}" print(subject.format(name)) "Treehouse loves MY NAME"

On Task from class name = "MY " "NAME" name (nothing returned) subject = "Treehouse loves {}" subject (nothing returned) print(subject.format(name)) result: Bummer! Be sure to use the '{}' [placeholder and the '.format()' method

Where the hell did i NOT use these!?

1 Answer

Nathan Tallack
Nathan Tallack
22,159 Points

No need to print. Just pop in the subject variable like this. :)

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

Thank you!