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 trialBenedict Ojuolape
1,834 PointsCode 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(''))
2 Answers
Megan Amendola
Treehouse TeacherHi! 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.
Benedict Ojuolape
1,834 PointsThanks, Megan. I managed to work it out! :)