Skip to content

Commit

Permalink
adding list comprehensions to problem 11
Browse files Browse the repository at this point in the history
  • Loading branch information
rcuhljr committed Jan 16, 2012
1 parent dc5bba6 commit 7f2d34f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions prob11.py
Expand Up @@ -21,8 +21,7 @@ def checkdir(xstep, ystep):
return 0
if(ystep < 0 and y-3 < 0):
return 0
return reduce(lambda a, b: a*b,
map(lambda a,b: int(grid[y+ystep*b][x+xstep*a]), range(4), range(4)))
return reduce(lambda a, b: a*b,[int(grid[y+ystep*b][x+xstep*a]) for (a,b) in zip(range(4),range(4))])
return max(map(checkdir, xvals, yvals))

def loadGrid(file):
Expand Down

0 comments on commit 7f2d34f

Please sign in to comment.