Skip to content

4.1.2 Parameters and Return Values

Parameters allow a function to receive input, and return values allow it to produce output.


Parameters

Parameters:

  • Are defined inside the function parentheses
  • Receive values when the function is called
  • Allow functions to operate on different data

A function may have zero or more parameters.


Return Values

The return statement:

  • Sends a value back to the caller
  • Terminates the function execution
  • Can return any data type

If no return statement is present, the function returns None.


📌 Note:
Clear input and output design makes functions easier to test and reuse.