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 (Retired) Ins & Outs Ins & Outs

Python string format

I get expected output in python console but when I check the code challenge task I get error. Can anyone tell me what am I missing here?

Thanks!

name.py
name = 'Rajanand Ilangovan'
treehouse = 'Tree'+'house'
email_greeting = ('{} loves {}'.format(treehouse,name))
print email_greeting

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

Hii Rajanand, Your code actually passes for me, provided you correct the syntax error (for Python 3.x) by add the missing parentheses on the print statement, or if you comment out the print statement which is not needed for the challenge.

Thank you, Chris!

Dan Johnson
Dan Johnson
40,532 Points

As of Python 3, print is treated just like any other function instead of a keyword, so you need the parentheses to call it:

print(email_greeting)

If you were checking with an older version of Python your code would have ran fine.

Thank you, Dan!