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

Philip Lewis
Philip Lewis
200 Points

Having some trouble with the format method

can't figure out what it is that I'm doing wrong here.
name = "Philip"

subject = "Treehouse loves {}"

print("Treehouse loves".function(name))

I've also tried putting (Philip) instead of (name) after the function

Philip Lewis
Philip Lewis
200 Points

oops I meant to put format instead of function in the code

2 Answers

The challenge didn't ask you to print anything.

If you get rid of the print statement, you should end up like this:

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

Good luck! ~alex

Philip Lewis
Philip Lewis
200 Points

Oh man lol I'm usually a pretty good listener but I guess I slipped on this one. Thank you so much. lemme go try this now. I'm sure it will work.

No problem :)

Philip Lewis
Philip Lewis
200 Points

Wow ok so I finally got it and I don't understand what it is I did differently this time. Was the same thing i had been doing the whole time but here's what I did.

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

Thanks for the help man. I appreciate it.

No problem (again)! :)

I'm happy to help. :smile: