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

Patrick Shushereba
Patrick Shushereba
10,911 Points

Ins & Outs Help

I'm not sure what's wrong with my code for the 3rd part of the challenge.

name.py
name = "Patrick"
treehouse = "Tree" + "house"
email_greeting = print(" {} loves {} ".format(treehouse, name))

2 Answers

Dan Johnson
Dan Johnson
40,533 Points

The print function returns no value, causing email_greeting to end up as None. The format string (and call to format) you have is fine, just be mindful of the extra white space at the ends.

Patrick Shushereba
Patrick Shushereba
10,911 Points

Are you saying that the print function is supposed to return a value, and mine isn't, or that in general it doesn't return a value?

Dan Johnson
Dan Johnson
40,533 Points

The print function never returns a value. It just prints output. Here's the documentation page if you want more details

Patrick Shushereba
Patrick Shushereba
10,911 Points

You mentioned that the email_greeting was ending up as none, but I don't want that. I need it to end up as the printed output, right? I've taken the spaces out of the last line, leaving me with:

email_greeting = print("{} loves {}".format(treehouse, name))

You said that the format part of the line is okay, so I'm trying to find the problem. I tried running it with the parentheses removed from the print function, but that doesn't work. I guess I'm not seeing what needs to change.

Dan Johnson
Dan Johnson
40,533 Points

The challenge only wants the variable email_greeting to contain the string. You don't have to deal with any output so you can get rid of print entirely.