-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path40.py
37 lines (26 loc) · 809 Bytes
/
40.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
import math
INDEXES_TO_MULTIPLY = [1, 10, 100, 1000, 10000, 100000, 1000000]
#INDEXES_TO_MULTIPLY = [1, 10, 100, 1000, 10000, 100000]
#INDEXES_TO_MULTIPLY = [1, 10, 100]
def CreateDigitsString():
global digits_string
string_list = list("0" * INDEXES_TO_MULTIPLY[len(INDEXES_TO_MULTIPLY) - 1])
current_index = 0
i = 1
while (current_index < len(string_list)):
new_string = str(i)
for ch in new_string:
if (current_index >= len(string_list)):
break
string_list[current_index] = ch
current_index += 1
i += 1
digits_string = "".join(string_list)
def Calculate():
global digits_string
CreateDigitsString()
product = 1
for i in INDEXES_TO_MULTIPLY:
product *= int(digits_string[i - 1])
return product
print Calculate()