aboutsummaryrefslogtreecommitdiff
path: root/challenge-033/orestis-zekai/python/letterCounter.py
blob: 10c112e59a981816c5b6f6ec107ab0882d9e1ee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# Count Letters (A..Z)
f = open("input.txt", "r")
input_text = f.read()

dictionary = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
counter = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}

for i in range(0, len(input_text)):
	if (input_text[i].lower() in dictionary):
		counter[input_text[i].lower()] += 1

print(counter)