Update count_occurences.md
This commit is contained in:
committed by
GitHub
parent
1e16cd5298
commit
88dceb260a
@ -5,7 +5,7 @@ tags: list,beginner
|
|||||||
|
|
||||||
Counts the occurrences of a value in a list.
|
Counts the occurrences of a value in a list.
|
||||||
|
|
||||||
- Use the `count` method of Python's list object to count the number of occurrences.
|
- Use `list.count()` to count the number of occurrences of `val` in `lst`.
|
||||||
|
|
||||||
```py
|
```py
|
||||||
def count_occurrences(lst, val):
|
def count_occurrences(lst, val):
|
||||||
|
|||||||
Reference in New Issue
Block a user