-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path17.py
50 lines (41 loc) · 965 Bytes
/
17.py
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
42
43
44
45
46
47
48
49
50
digits = [
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine"
]
n_digits = sum([len(i) for i in digits])
unique = [
"ten",
"eleven",
"twelvethirteenfourteenfifteensixteen",
"seventeeneighteennineteen"
]
unique = sum([len(i) for i in unique])
# 20-30 is twenty x, twenty x, etc. 10x 'twenty' plus length of digits
# this continues untill one hundred
teens = [
"twenty",
"thirty",
"fourty",
"fifty",
"sixty",
"seventy",
"eighty",
"ninety"
]
# 1-9 + 10-19 + 20-99
total_hundred = unique + n_digits + 9 * (sum([len(i) for i in teens]) + n_digits) + 1
# hundreds is X hundred and Y, so total_hundred + 99 * (X hundred and) + X hundred
total_thousand = total_hundred
for i in digits:
temp = total_hundred + (len(i) + len("hundredand")) * 100 - 3
total_thousand += temp
total_thousand += len("onethousand")
print(total_thousand)
print(total_hundred)