Countr python code example
Example 1: python count
Format: string.count(sub, start= 0,end=len(string))
string = "Add Grepper Answer"
print(string.count('e')
>>> 3
Example 2: python counter
>>> Counter('abracadabra').most_common(3)
[('a', 5), ('r', 2), ('b', 2)]
Example 3: python counter
sum(c.values())
c.clear()
list(c)
set(c)
dict(c)
c.items()
Counter(dict(list_of_pairs))
c.most_common()[:-n-1:-1]
c += Counter()
Example 4: count in python
it counts the number of elements in the list or in the string(words)