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

# Inline Variable

#### Sourcery refactoring id: `inline-variable`

#### Description:

Inline variable that is only used once

#### Before:

```python
thelist = []
for i in range(10):
    k = i**2
    thelist.append(k)
```

#### After:

```python
thelist = []
for i in range(10):
    thelist.append(i**2)
```

#### Explanation:

Inlining variable can help to streamline the code, but can also make it less
readable. Sourcery will only inline variables where doing so allows further
readability changes to be made, such as converting a loop into a list
comprehension.
