Blame view

8.py 436 Bytes
Imanol-Mikel Barba Sabariego authored
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
#!/usr/bin/python

import sys;
import math;

def fiveDigitProduct(num,offset):

	sum = 1;
	for i in range(offset,offset+5):
		sum *= int(num[i]);

	return sum;

def greatestProduct(num):

	higherProduct = 0;
	for i in range (0, len(num)-4):
		product = fiveDigitProduct(num,i);
		if(product > higherProduct):
			higherProduct = product;

	return higherProduct;


strNum = sys.argv[1];
print "Result is: " + str(greatestProduct(strNum));