Language: EN

python-retorno-funcion

Return values of functions in Python

The return values of a function are a value that the function can return (optionally) as a result, after performing its operations.

Return values allow functions to perform calculations and operations, and then pass the result back to the code that called them.

Syntax of return

In Python, the return statement is used to return a value from a function, to the point from where the function was called.

When the return statement is encountered, the execution of the function stops and the value specified after return is returned as the function’s result.

The basic syntax of return is as follows:

def function_name(parameters):
    # function code block
    return value_to_return

Practical Examples

:::::::