Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.

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


2 Answers

Megan Amendola
.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! :)