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

Daniel Malek
Daniel Malek
20,140 Points

My answer to the task is name = "Daniel" subject = "Treehouse loves {}" .format(name)

can't spot a problem. When I check my work I get a message that task no 1 is no longer passing

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

What's the task question?

3 Answers

Cheo R
Cheo R
37,150 Points

Hello Daniel, you've added a space between the end of the quotation mark and the period Just remove that space.

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

Actually, Python isn't that picky and that extra space is actually 100% fine and will still function properly. :)

Chris Howell
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Chris Howell
Python Web Development Techdegree Graduate 49,702 Points

Daniel Malek

Did you attempt to write this in a text editor outside of the challenge then copy/paste it inside?

I tried to copy paste your code into the challenge and it would not pass. But if I manually re-typed it character for character inside the challenge window, it passed just fine. With the exception that for this challenge you cannot have a space after the "Treehouse loves {}" and .format() (at least for the challenge). Python wont have a problem with this but the interpreter for the challenge will.

Try to manually retype line for line, do not copy paste from another editor or from terminal/console window. See if that gets it to pass, if it does then your issue was with hidden character encodings from your terminal/console or from the outside editor you were copying from.

What's the difference? I don't understand...

Chris Howell
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Chris Howell
Python Web Development Techdegree Graduate 49,702 Points

The difference between text-editors?

Lets take Notepad and WordPad for example. Both are text editors but 1 is a "Simple Editor" and the other is a more "special formatting" editor.

If you created a document in WordPad it would apply whatever specialize text formatting you saved it with, then if you went to open it in Notepad you would see all these cryptic characters. Sometimes where you had blank spaces in the WordPad version, in the NotePad version you now have these weird symbols.

Daniel Malek
Daniel Malek
20,140 Points

Thanks for quick reply to all. I did work in workspaces did not copy/paste from anywhere. For coding localy I use linux and sublime text editor. But in that case it was a browser glitch. I did exercise on my tablet and tape in all exacly same and worked just fine