How to count the total counter values of all counts in Python

1 Answer

0 votes
from collections import Counter

counter = Counter()
for ch in "python programming":
    counter[ch] += 1

print(sum(counter.values()))



'''
run:

18
 
'''

 



answered Jul 26, 2019 by avibootz
...