summaryrefslogtreecommitdiff
path: root/misc/characterCount.py
blob: de3b2efd8e6778fa02b00d894d12e4083cbb5f8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!Python

#Character count

import pprint

message = 'It was a bright cold day in April, and the clocks were strinking thirteen.'
count = {}

for character in message:
    count.setdefault(character, 0)
    count[character] = count[character] + 1

pprint.pprint(count)
print(pprint.pformat(count))