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

Hello, seeking assistance on how to do this challenge? I've tried several ways, but to no avail.

.

creating_functions.py
def hello_student(name):
    value = 'Hello'
    return value + name

hello_student('Keri')

1 Answer

Josh Keenan
Josh Keenan
20,315 Points

So this is my solution:

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

hello = hello_student("Tommy")

The first part just requires you to just return a string and add the name being passed in onto it.

Then the second part wants you to call the function and save that to a variable, you can save a function call to a variable just like a string or list.

my_variable = my_function()

Hope this helps

Josh, thanks!