-
Notifications
You must be signed in to change notification settings - Fork 0
/
Question10.py
executable file
·39 lines (34 loc) · 936 Bytes
/
Question10.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
#!/usr/bin/env python3.2
def FindLargest():
LastDigits = [0, 0, 0, 0, 0]
sum = 0
ix = 0
file_index = 0
r_file = open("input")
numbers = r_file.readline()
while len(numbers) != 0:
print(numbers[file_index])
if(numbers[file_index] == '\n'):
file_index = 0
numbers = r_file.readline()
continue
LastDigits[ix] = int(numbers[file_index])
print(LastDigits, MulitiplyList(LastDigits))
if MulitiplyList(LastDigits) > sum:
sum = MulitiplyList(LastDigits)
file_index += 1
ix += 1
if ix == 5:
ix = 0
return sum
def SumList(numbers):
sum = 0
for ix in range(len(numbers)):
sum += numbers[ix]
return sum
def MulitiplyList(numbers):
product = 1
for ix in range(len(numbers)):
product *= numbers[ix]
return product
print(FindLargest())