Shane SmithPython Development Techdegree Student 1,555 Points
Beginner challenge help!
I know that in line 4 i cant call the function i defined without passing it a parameter but I am unsure of how to proceed?
def hello_student(name): return "Hello "+name hello_student(): hello = return
rydavimTreehouse Moderator 18,641 Points
Alright - so the
return statement you wrote while defining the
hello_student function is what you'll be using to "generate" the value of your new
def hello_student(name): # from task 1 return "Hello " + name hello_student(): # no colon for function calls hello = return # the return statement is part of the function
Instead of thinking of it like writing a function, you're using the function you already wrote to save the result to a new
hello_student(rydavim) would return the value "Hello rydavim", but that isn't being saved anywhere unless you assign it to a variable.
# create a variable to save the return value of a function def exampleFunction(item): return "Your item is: " + item exampleVariable = exampleFunction(blueberries) # exampleVariable is now set as "Your item is: blueberries"
Hopefully that gets you going, but let me know if you've still got questions. Keep it up!