> ## 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.

# Use Count

#### Sourcery refactoring id: `use-count`

#### Description:

Replaces `sum()` with `count()` where appropriate

#### Before:

```python
return sum(hat == "bowler" for hat in hats)
```

#### After:

```python
return hats.count("bowler")
```

#### Explanation:

This simplification can be made where a call to `sum()` is counting the number
of elements that match a condition.
