> ## Documentation Index
> Fetch the complete documentation index at: https://python4ai.codewithsiva.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Functions

> Create reusable blocks of code

## Building with functions

Functions are reusable blocks of code that do specific tasks. Instead of writing the same code multiple times, you write it once as a function and call it whenever needed.

Think of functions like:

* A recipe you can follow multiple times
* A machine that takes input and produces output
* A named shortcut for complex operations

## Why use functions?

* **Don't repeat yourself**: Write code once, use it many times
* **Stay organized**: Break complex programs into smaller pieces
* **Fix bugs easier**: Change code in one place, affects everywhere
* **Test your code**: Test each function separately

## What you'll learn

<CardGroup cols={3}>
  <Card title="Defining functions" icon="function" href="/functions/defining-functions">
    Create your own functions
  </Card>

  <Card title="Parameters" icon="sliders" href="/functions/parameters">
    Pass data to functions
  </Card>

  <Card title="Return values" icon="arrow-turn-down" href="/functions/return-values">
    Get results from functions
  </Card>
</CardGroup>

## Real-world examples

Functions are everywhere in programming:

* `print()` - displays text (built-in function)
* `len()` - counts items (built-in function)
* `calculate_tax()` - your custom function
* `send_email()` - your custom function

## Let's begin!

Start by learning how to create your first function.

<Card title="Defining functions" icon="arrow-right" href="/functions/defining-functions">
  Create your first function
</Card>
