Skip to main content
By the end of this module you can do everything below. The objectives and their wording come from the official PCEP-30-03 syllabus.

4.1.1 Define and invoke user-defined functions

  • Explain how functions support code decomposition, reuse, and maintainability.
  • Define a function using the def keyword.
  • Create valid function names according to Python naming rules.
  • Define a function body using correct indentation.
  • Invoke a user-defined function.
  • Trace the order in which function definitions and function calls are executed.

4.1.2 Return values from functions

  • Use the return statement to return a result from a function.
  • Assign a returned value to a variable.
  • Use returned values in expressions and function calls.
  • Explain the difference between returning a value and displaying a value with print().
  • Explain how return terminates the current function call.
  • Return multiple values from a function.
  • Recognize when a function implicitly returns None.
  • Use the None value to represent the absence of a meaningful result.

4.1.3 Define parameters and pass arguments to functions

  • Distinguish between parameters in function definitions and arguments in function calls.
  • Pass arguments by position and keyword, and combine them in the correct order.
  • Define parameters with default values.
  • Call functions using default values or override them with explicit arguments.
  • Use keyword arguments with built-in functions such as print(), including sep and end.
  • Recognize invalid function calls caused by missing, duplicated, or incorrectly ordered arguments.