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

satish kumar sannapaneni
PLUS
satish kumar sannapaneni
Courses Plus Student 207 Points

String formatting

HI, I NEED HELP IN MOVING FORWARD ON THIS TASK.

strings.py
name =  "satish kumar"
subject = "Treehouse loves {}" + name
subject = subject.format(name)

1 Answer

Jaxon Gonzales
Jaxon Gonzales
3,562 Points

Hi Satish!

To format a string you can use the .format() method. The problem with your code is that you are trying to format and concatenate (use the '+' operator) the string. I'm not sure about the instructions to this code challenge but I think it would go something like this:

name = "Jaxon"
subject = "Treehouse loves {}".format(name)
# Subject is now equal to "Treehouse loves Jaxon"

Next time I would suggest also putting the instructions given to the code challenge. If this helps click the up arrow!

<Thanks, > <Jaxon>