Js Array Reduce Sum Python Function