Created
March 25, 2015 19:34
-
-
Save jamesmcnamara/e67389b8352c4c70be25 to your computer and use it in GitHub Desktop.
sum67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sum67(nums): | |
return sum(map(lambda inums: reduce(lambda acc, (x, y): acc + sum(x), [(list(takewhile(lambda x: x != 6, inums)), list(takewhile(lambda x: x != 7, inums))) for _ in range(nums.count(6) + 1)],0) if nums.count(6) else sum(nums), [iter(nums)])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment