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

General Discussion

Fin Muir
Fin Muir
1,108 Points

Task 1 isn't passing

I am doing this coding challenge with 2 tasks. I tried to click on check work on the second task but it just told me that task one wasn't passing

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

1 Answer

Stuart Wright
Stuart Wright
41,119 Points

You sometimes get that message when you have introduced a syntax error with your attempt at the second challenge, and it means nothing gets executed at all (which means the first challenge fails).

That is the case here. You have the order mixed up a little in that last line. The correct syntax is:

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

"Treehouse loves {}" is a string, and format() is a string method. You call the format method on the string, and the argument you pass to the method (name, in this case), goes where the placeholder {} is.