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

Alex Pearson
Alex Pearson
1,820 Points

Answer not accepted

I have checked my work in the python console and still receive an incorrect response.

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

Perhaps I am reading the question incorrectly, but at this point I am unable to continue.

Cheers

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

2 Answers

Vidhya Sagar
Vidhya Sagar
1,568 Points

You dont have to use print.The challenge has just asked you to assign it and leave it as such. .format can be used anywhere ,not only in print command .

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

Your answers are fantastic. :+1:

I noticed something. Sorry if this sounds mean, I'm just trying to help you make even more professional answers :wink:

You shouldn't have spaces before punctuation (!, ., ,, etc). You also should have spaces after punctuation.

Instead of:

Hello .My name is Alex .Nice to see you !

You can write more professionally like this:

Hello. My name is Alex. Nice to meet you!

Again, this isn't required, and no, I'm not trying to be mean. I'm just trying to help you make your answers be more professional :+1:

Just a heads up!

Vidhya Sagar
Vidhya Sagar
1,568 Points

Hey  Alexander Davidson. Thanks man. I really apperciate it. I am i beginner and i did not take you as mean, infact i want you to guide me in such ways. Cheers. Happy Coding.

Alex Pearson
Alex Pearson
1,820 Points

Vidhya Sagar, thank you for your response. I was able to complete the challenge and have a better understanding of what the question was asking for.

Can you please provide a Best Answer for Vidhya? Thank you.

It will mark your question as answered and It will also give 12 forum points to the person who receives the Best answer.

Thanks for understanding :grin: