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

No idea help please

I have watched this video multiple times and there is nothing in it relating to this task thing. I am so confused!!!!!

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

print(hello_student('ROk'))

1 Answer

Tim Oltman
Tim Oltman
7,730 Points

Check out the videos: All About Returns and Arguments and Parameters.

You want to your function to take an argument named name. Here's how you would create an function to take an argument named x:

def add_two(x):
   return x + 2

You want your function to return "Hello Rigby" where "Rigby" is the value passed into the function. Strings can be combined in python with the '+' operator

var = "efg"
msg = "abcd " + var

msg will now have the value "abcd efg".

Finally, you have to read the instructions carefully about how the function should be called. They want the returned value assigned to a variable named hello (not printed). Figure that out and you will be good to go!