Introduction

Completed

As your programs grow, you'll start noticing the same logic showing up in more than one place. Copy-pasting that logic works for a while, but it quickly becomes hard to update, easy to break, and painful to read. Functions solve that problem by giving a name to a block of code and letting you reuse it anywhere.

In this module, you learn how to define functions, pass data to them with parameters, get results back with return values, and understand how variable scope keeps your code from stepping on itself. You also learn how to split code across multiple files and import your own modules. Finally, you'll build a calculator that organizes its operations into functions.