# Refactor
{id: refactor}

## Refactoring example - change variable name
{id: refactoring-change-variable-name}

![](examples/refactor/bad_variable.py)

![](examples/refactor/good_variable.py)

## How to Refactor
{id: how-to-refactor}

* Write tests that will verify the behaviour (or at least compare the new behavior to the old behavior)
* Make a small change.
* Run the tests.

## Exercise: Fix deep indentation
{id: exercise-fix-deep-indentation}

![](examples/refactor/remove_deep_indentation.py)

![](examples/refactor/count_dna_bases.py)
