Module 6: Introduction to Functions

Module 6: Introduction to Functions#

Module 1 Objectives:
By the end of this module, you will be able to:

  • Understand how to define a function in a programming language.

  • Learn how to call a function to execute its code.

  • Understand the concept of return values from functions versus functions that only print output without returning values.

  • Differentiate between local and global variables.

  • Write and utilize docstrings to document functions.

  • Differentiate between arguments and parameters in functions.

  • Recognize how the number of arguments affects function calls and definitions.

  • Implement default parameter values in function definitions.

In the previous sections, we’ve talked about several built-in functions like print() and input(), as well as functions from installed packages like numpy’s array() and pandas’ read_csv().

Now we’ll talk about how you can write your own functions.