loop
← All sections

Module 4 · Functions, tuples, dictionaries, exceptions, and data processing

Functions

The single most important tool for taming complexity: a named, reusable block of code. Learn why functions exist, how breaking a problem into them keeps it manageable, where they come from, and how to write your own.

Begin lesson 1 →
  1. 1What is a function, and why?A named, reusable block of code — write it once, call it as often as you like.
  2. 2DecompositionSplit a big, daunting problem into small, named pieces you can tackle one at a time.
  3. 3Where functions come fromBuilt into Python, imported from a module, or written by you — all called the same way.
  4. 4Your first functionDefine one with def, call it, and watch control jump in and return.