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

How do we write a Python code of .format

name = Aflo Pop subject = name.format("Treehouse Loves"{})

2 Answers

Steven Parker
Steven Parker
243,318 Points

You have your template and argument reversed. The template goes in front of ".format", and the argument goes inside the parentheses.

Also, be careful to keep the template as provided in the instructions, with the braces inside the quotes with the other text. And it looks like you still need quotes around string being assigned to "name".

Here is a quick example of .format:

name = "Aayush {}"
full_name = name.format("Mitra")
print(full_name)

Hope this helps!

Thanks! :)

Steven Parker
Steven Parker
243,318 Points

That might work in an IDE but it's not really what the challenge instructions say to do.

Okay, sorry about that.

I have put an answer to the actual challenge.

Sorry once again.

Could you please tell me what challenge he is on Steven? It did not have the link saying "veiw challenge".

Thanks! :)

Steven Parker
Steven Parker
243,318 Points

No, that button is not present. I suspect this question was not created with the "get help" button.