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

I don't know what's wrong with my answer

Here is my code for challenge task part 2

creating_functions.py
def hello_student(name):
    return( "Hello " +  name )
    hello_student()
    val = return(hello)

1 Answer

Steven Parker
Steven Parker
231,124 Points

The (first) "return" line ends the function. All the code after it that is indented will be ignored.

But even without the indentation, the next line only does part of what the instructions ask. They say "Call the hello_student() function and save the return value to a variable called hello.". The function is being called, but the output isn't being saved.

And the final line is not proper syntax and isn't needed anyway.