Virtually every programming language has functions and procedures, a way of separating out a block of code that can be called many times from different places in your program, and a way to pass parameters into them. Python is no different, so we'll quickly run over the standard stuff that most languages have, then take a look at some of the cool stuff Python has to offer.
def functionname( parameters ): "function_docstring" function_suite return [expression]
def foo(val1, val2, val3): return val1 + val2 + val3
When executed we get the following:
>>> print(foo(1, 2, 3)) 6
This function has 3 positional parameters (each one gets the next value passed to the function when it is called -val1 gets the first value (1), val2 gets the second value (2) and so on).