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 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

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