Skip to content
  • Home
  • How To
  • M0
  • Module 1 - Python
  • Agents
  • M2
  • M3
  • M4
  • M5
  • M6
  • Progress
  • Contact
  • Pricing
  • Sign in
  • Future
  1. Module 1M1
  2. ›
    S3Functions
  3. ›
    Intro
  4. ›
    S3›Intro
  1. Module 1
  2. ›
  3. Section 3

Section 1.3: Functions

A function is a named, reusable piece of behavior with a defined way in and a defined way out. That definition is doing more work than it appears to: the way in is the argument rules, which decide what a caller may pass and in what order, and the way out is the return value, which is not the same thing as what the function prints. Between them sits scope, the rule that decides which names a function can see and change, and beside it the side effect, where the quiet bugs live, the ones where a function silently modifies something its caller still depends on.

Section 2 gave you decisions and repetition, so your programs can now do different things depending on their input. What that produces, left alone, is one long script where every piece of logic exists exactly once, in one place, in one order. The moment the same calculation is needed twice you copy it, and from then on you have two versions that have to be corrected together and will not be.

Lessons

  1. Defining and Calling Functions - creating a named behavior and invoking it.
  2. Arguments in Depth - Positional, Keyword, and Default - how the values a call passes reach a function's parameters, by position, by name and by default.
  3. Scope, Side Effects, and Pure Functions - which names a function can see, and what it changes outside itself.
  4. Decomposition and Composition - Building With Functions - splitting a problem into small functions and feeding each one into the next.

By the end you will be able to:

  • Write a function with required and default parameters, and call it with positional and keyword arguments.
  • Predict what a function returns as distinct from what it prints.
  • Identify a side effect in someone else's function and separate it from the pure logic around it.
  • Decompose a multi-step task into functions that compose without sharing data that any of them changes in place.
Your progress
Current streak
🔥 0
Lessons marked today
0 / 3
Longest streak
0

Sign in

The bootcamp

  • Curriculum
  • How To
  • Pricing
  • Changelog
  • Future

The community

  • Discord
  • Reviews
  • Contact

Follow

  • Instagram
  • X
  • TikTok
  • Reddit

Legal

  • Terms
  • Privacy
  • Refunds

Coming soon on November 16, 2026

The AI/ML Newsletter, free.

SubscribeComing soon on December 1, 2026

Confirm by email, unsubscribe in one click.

Theme