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

Kade Carlson
Kade Carlson
5,928 Points

Not sure what I did wrong

Please check my code and explain what I am doing wrong. It seems like everything is correct and I am doing exactly what we did in the lesson

strings.py
name = "Kade"
subject = "Treehouse loves {} "
print(subject.format(name))

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Kade,

While, technically, the code above is correct, it is not what the challenge asked you to do. Challenges are very specific and picky, so it's important to follow the instructions exactly.

The challenge did not ask you to print anything, so that line needs to be deleted. It only asked you to assign the requested string to the subject variable. Also, you have a trailing space in the string that needs to be deleted.

So, once you move all the pieces around and deleted what wasn't asked for...

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

Your code will pass. :)

Keep Coding! :dizzy:

Kade Carlson
Kade Carlson
5,928 Points

Oh ok, thank you very much!