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.
def hello_student(name): name = 'Becky' greeting = ('Hello ' + name) return greeting print(hello_student(''))
Megan AmendolaTreehouse 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! :)