master
1
2f = {
3 "a": 8.167,
4 "b": 1.492,
5 "c": 2.782,
6 "d": 4.253,
7 "e": 12.702,
8 "f": 2.228,
9 "g": 2.015,
10 "h": 6.094,
11 "i": 6.966,
12 "j": 0.153,
13 "k": 0.772,
14 "l": 4.025,
15 "m": 2.406,
16 "n": 6.749,
17 "o": 7.507,
18 "p": 1.929,
19 "q": 0.095,
20 "r": 5.987,
21 "s": 6.327,
22 "t": 9.056,
23 "u": 2.758,
24 "v": 0.978,
25 "w": 2.360,
26 "x": 0.150,
27 "y": 1.974,
28 "z": 0.074
29}
30
31for w in open('dict.txt'):
32 if (
33 (w[2] == 'h' or w[3] == 'h') and
34 (w[0] == 't' or w[1] == 't' or w[4] == 't') and
35 'a' not in w and 'c' not in w and 's' not in w and 'm' not in w and
36 'o' not in w and 'n' not in w and 'u' not in w and 'e' not in w
37 ):
38 w = w.strip()
39 weight = 0
40 c_counts = {c: w.count(c) for c in set(w)}
41 for c in c_counts:
42 weight += f[c]
43 print (round(weight,3),w)