@betaProjects/

Project Euler 8

Python 2.7

No description

fork
loading
Files
  • main.py
  • pe8.txt
main.py
1
2
3
4
5
6
7
from operator import mul
d = map(int, ''.join(line.rstrip() for line in open('pe8.txt')))

L = input('Enter a set length? ')
print 'Greatest product of', L, 'consecutive digits =', 
print "None."  if L>len(d) else  \
       max(reduce(mul, d[i:i+L]) for i in xrange(len(d)-L+1))