-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path12.py
More file actions
44 lines (31 loc) · 974 Bytes
/
12.py
File metadata and controls
44 lines (31 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
f = open('file.txt', 'r')
x = f.readlines()
f.close()
letters = ['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']
stat = []
for init in range(26):
stat.append(0)
for ch in str(x):
for letter in range(26):
if ch.upper() == letters[letter].upper():
stat[letter] = stat[letter] + 1
max = []
maxcount = 0
mincount = stat[0]
min = []
for index in range(26):
if maxcount < stat[index]:
max = []
max.append(letters[index])
elif maxcount == stat[index]:
max.append(letters[index])
if mincount > stat[index]:
min = []
min.append(letters[index])
elif mincount == stat[index]:
max.append(letters[index])
strr = str(x)
strr = strr.upper().replace(max[0].upper(), '±±§§-=')
strr = strr.upper().replace(min[0].upper(), max[0].upper())
strr = strr.upper().replace('±±§§-=', min[0].upper())
print(strr.lower())