Skip to content

Instantly share code, notes, and snippets.

@jamesmcnamara
Created March 25, 2015 19:34
Show Gist options
  • Save jamesmcnamara/e67389b8352c4c70be25 to your computer and use it in GitHub Desktop.
Save jamesmcnamara/e67389b8352c4c70be25 to your computer and use it in GitHub Desktop.
sum67
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