-
Notifications
You must be signed in to change notification settings - Fork 0
/
euler_08.py
47 lines (35 loc) · 1.05 KB
/
euler_08.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
#################### 1 ####################
from euler_8_text import number
def largest_product(series):
global number
number = number.split("\n")
number = "".join(number)
highest_number = 0
i = 0
for a in range(0,len(number)-14):
result = 1
num = number[a:a+series]
for q in range(series):
result *= int(num[q])
if result > highest_number:
highest_number = result
i += 1
print(f"Result:{highest_number}")
largest_product(13)
#################### 2 ####################
from euler_8_text import number
def largest_product(series):
global number
number = number.split("\n")
number = "".join(number)
highest_number = 0
while len(number) > 12:
result = 1
k = number[0:series]
for i in k:
result *= int(i)
if result > highest_number:
highest_number = result
number = number[1:len(number)+1]
print(f"Result:{highest_number}")
largest_product(13)