-
Notifications
You must be signed in to change notification settings - Fork 496
Open
Description
! /usr/bin/env python3
"""To find the number of times characters are repeated in a string """
from collections import Counter
Counter('abracadabra').most_common(3)
[('a', 5), ('r', 2), ('b', 2)]
The argument of most_common is the number of items to be returned
Default will return count for all characters
Counter('abracadabra').most_common(1)
[('a', 5)]
Metadata
Metadata
Assignees
Labels
No labels