# Count occurrences

Canonical: https://www.wiki.jodisand.me/snippets/python/count_occurrences/


Counts the occurrences of a value in a list.

- Use `list.count()` to count the number of occurrences of `val` in `lst`.

```py
def count_occurrences(lst, val):
  return lst.count(val)
```

```py
count_occurrences([1, 1, 2, 1, 2, 3], 1) # 3
```


