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

Nisha Midha
Nisha Midha
1,925 Points

I need help with the challenge task 2 of 2

please help me code second task

strings.py
name = "Hey, all practice is good practice, right?"
subject = "Treehouse loves" .format(+ name)"

2 Answers

jacksonpranica
jacksonpranica
17,610 Points

Hey Nisha,

First off, you need to include a {} inside your subject variable string just like task 2 tells you. It should say, "Treehouse loves {}". That is because the {} acts as a placeholder for the variable you will insert using the format.

Secondly, the .format() only needs name inside of it. So it needs .format(name). The '+ name' is not correct.

Take those hints and go finish that challenge! :]

Nisha Midha
Nisha Midha
1,925 Points

I tried that already and it didn't work. I coded second task as subject = "Treehouse loves{}" Then how do I code the second part to show the format? .format(name)

prateek parasher
prateek parasher
806 Points

i think this should work name = "Deja vu" subject += "Treehouse loves {}" .format(name) print (subject) but in work space it showing error " It looks like Task 1 is no longer passing."