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

Jason Loveless
Jason Loveless
726 Points

This function should return one value, the string 'Hello ' followed by the value of the name parameter.

tried completing this using the lecture content however im' still getting the wrong answers, pls help

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

print(hello_student(Jason))

2 Answers

# OK
def hello_student(name):
# They want space after Hello like this, 'Hello '
    val = 'Hello' + name
# OK
    return val
# 1 of 2, this is all you need to complete the first challenge
--------------------

# 2 of 2, they want you to call the function and save it you hello variable
# not to print the function.
# Also Jason needs quotes because we pass it as a string, so it needs to be passed like this 'Jason'/"Jason"
print(hello_student(Jason))

# Check the Final code below and compare it your code.


# Final
def hello_student(name):
    val = 'Hello ' + name
    return val

hello = hello_student('Jason')
Jason Loveless
Jason Loveless
726 Points

thank you, I was basically there ahaha