Guest User

Untitled

a guest
Dec 11th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. def nested_sum(x):
  2. return sum(numbers(x))
  3.  
  4. def numbers(xs):
  5. if isinstance(xs, array):
  6. yield from itertools.chain(numbers(x) for x in xs)
  7. else:
  8. yield xs
Add Comment
Please, Sign In to add comment