# Code

> Run a small Python script in a secure sandbox.

Built-in step · 1 step. Web page: https://docs.lodol.com/docs/integrations/built-in/code

To learn when to use these steps, with examples, read [Call an API or run code](https://docs.lodol.com/docs/guides/http-and-code.md).

## Steps

### Run Python code

Run a short Python script for the things no other step covers, such as reshaping data or a custom calculation. It runs offline, with no internet or file access, and returns whatever your script assigns to a variable named output.

**Inputs**

- Python code (`code`, text, required): Your script. Read the values you mapped in by name, or from the inputs dictionary, and assign this step's result to a variable named output.
- Inputs (`inputs`, object): The workflow values your code can use. Each one gets a name you refer to in the code.
- Output type (`output_type`, text): What this step returns. Auto keeps whatever your code produced; picking a type checks it before later steps use it. One of: `auto`, `text`, `number`, `boolean` (True/False), `list`, `object`. Default: `auto`.

**Outputs**: Whatever the script assigns to output, converted to the chosen output type.

**Example output**

```json
{
  "currency": "USD",
  "line_count": 3,
  "total": 1249.5
}
```
