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

Code Challenge Functions

Hi, I'm not sure at all what I'm doing wrong here.

When I try to test this in the console, it comes out as Hello Becky. So I'm not sure what I'm getting wrong here.

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

print(hello_student(''))

2 Answers

Megan Amendola
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Megan Amendola
Treehouse Teacher

Hi! On your second line, you are overwriting the name argument so that no matter what is passed into the function, it will always return "Hello Backy". You want to use what is passed into the argument so the function will say hello to any name that is passed in.

For part 2 of the challenge, it asks you to "Call the hello_student() function and save the return value to a variable called hello." You are missing the variable hello. Instead, you are printing out the result. You need to change that line so it is a variable called hello where you call the function and pass in a name.

Thanks, Megan. I managed to work it out! :)