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

Michael Kaminski
Michael Kaminski
1,419 Points

I am having trouble returning the proper output from the function. I am not sure what I am doing wrong

I seem to be having trouble getting the variable hello assigned to the function. When I use a REPL in the workspace it checks out, so I am not sure that I am doing something wrong, though I get an error message when I go to check work.

creating_functions.py
def hello_student(name):
    hello="Hello " + name
    return hello
print(hello_student("name"))
Abdullah Aldughaimi
Abdullah Aldughaimi
7,103 Points

def hello_student(name): return "Hello {}".format(name) print(hello_student("name"))

I hope this help

1 Answer

I coded your function and it looks like it may be an indentation issue. Here is what I coded.

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

print(hello_student("Bob"))