Skip to content

Functions

Python Functions

Define your own functions. def func_name(arg1, arg2): then indent the body of the function. Functions can return values.

def combine_name(first_name, last_name):
    full_name = first_name + " " + last_name
    print(full_name)
combine_name("Terry", "Dutcher")

Can return values from a function.

def combine_name(first_name, last_name):
    full_name = first_name + " " + last_name
    return full_name

fname = combine_name(first_name, last_name)
print (fname)