Ad
Code
Diff
  • from functools import reduce
    def sum(arr):
        return reduce(lambda x, n: x + n, arr, 0)
    
    • from functools import reduce
    • def sum(arr):
    • var = 0
    • for i in arr:
    • var += i
    • return var
    • return reduce(lambda x, n: x + n, arr, 0)