Thursday, December 26, 2019

Sum and Prod - Hacker Rank Solution

Sum and Prod - Hacker Rank Solution
This can be solved by first computing the sum along axis  and then using prod.
import numpy

N, M = map(int, raw_input().split())

my_array = numpy.array([ map(int, raw_input().split()) for i in range(N) ])
print numpy.prod( numpy.sum( my_array, axis = 0 ) )

No comments:

Post a Comment

Powered by Blogger.