Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Functions, Packing, and Unpacking Getting Info In and Out of Functions Functions with Arguments and Returns

avery koon
avery koon
5,316 Points

Code editor not correctly validating python code

Hey guys,

I’ve entered a number of correct answers to this question but it’s prompting me to recheck work stating it’s invalid. The exercise is just asking to make a function that returns “hello “ along with a name, but it continues to bomb out. My answers have been:

def hello_student(name): mess = print(“Hello “ +name) return mess

def hello_student(name): print(“Hello “+name)

def hello_student(name): print(f”Hello {name}”)

Each followed by hello_student(“Timmy”) in any editor i know and they all print out “Hello Timmy” or anything i assign to in the editor. Feel free to respond/update in the comments. Thanks in advance

creating_functions.py
def hello_student(name):
    print("ello "+name)

1 Answer

Indiya Gooch
Indiya Gooch
12,050 Points

I understand where you're coming from, the challenges question confused me a little too, but when it says "return" it did literally mean return not print. It got me too. Your answers were fine, just not what it was after. Hope this helps. EI:

def hello_student(name):
    return "Hello "+ name