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

David Marrufo
David Marrufo
3,702 Points

Why is my answer incorrect? I have tested it out on my own python editor and it works.

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

creating_functions.py
def hello_student(name):
    return print('Hello {}'.format(str(name)))

2 Answers

Cameron Childres
MOD
Cameron Childres
Treehouse Moderator 11,680 Points

Hi David,

The challenge asks you to "return one value, the string 'Hello ' followed by the value of the name parameter". They aren't asking for anything to be printed, just for 'Hello {}'.format(str(name)) to be returned.

Remove the print function and you should be good to go:

def hello_student(name):
    return 'Hello {}'.format(str(name))
David Marrufo
David Marrufo
3,702 Points

Thank you so much, Cameron! Your response helped...I was really stuck!