Functions in Python

Contents

Functions in Python#

In Python, a function is a named sequence of statements that performs a computation.

  • Key term: function

To execute a function, we call it by name and pass it an appropriate set of input arguments. A function takes zero or more arguments as inputs and returns zero or more outputs as a result. The output or result of a function is called the return value.

  • Key terms: function call, input argument, function output or return value

Data, parameters, or arguments can be passed into a function. Functions can also return data.

Section Contents#