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 trial

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

saving the variable

I am trying to save the return value but every time I do that it just says 'Error'.

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

hello_student()

2 Answers

Brandon White
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 Points

Hi Faraz,

Two things. One) Make sure you’re saving the returned string to a variable named hello. And Two) Make sure you actually pass an argument (ie. your name as a string) into the hello_student function.

If that doesn’t work let me know.

boi
boi
14,242 Points

I copy/pasted your code into the challenge and it gave me an error message "Bummer: TypeError: hello_student() missing 1 required positional argument: 'name' instead of Error

The purpose of your function hello_student() is similar to giving a shoutout like "Hello Faraz", so I think you are missing a positional argument in the function call just like what the error suggests "Bummer: TypeError: hello_student() missing 1 required positional argument: 'name'"

And once you get that sorted out, the challenge also requires you to store the function hello_student into a variable

post back if the problem persists