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

Bug

Hi Guys, I think to have a bug in this challenge. If I write this code in the workspace is correct and everything works fine but in the challenge doesn't work and I can't go on.

Is it a bug? or am I making some mistake?

Thx for the answer

strings.py
name = 'Michele' 
subject = 'Treehouse loves {}'
print(subject.format('name'))

2 Answers

Christian Mangeng
Christian Mangeng
15,970 Points

Hi Michele,

no bug. Actually, 3 things need to be fixed here:

1) you are formatting the subject string with a string called "name", instead of the variable name

2) you don't need to print the formatted string

3) you need to assign the formatted string to subject. Currently, subject still has the empty placeholder in it.

name = 'Michele' 
subject = 'Treehouse loves {}'.format(name)

Thx for your help Christian :)