We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Numpy
- Sum and Prod
- Discussions
Sum and Prod
Sum and Prod
Sort by
recency
|
369 Discussions
|
Please Login in order to post a comment
Here is HackerRank Sum and Prod in Python solution - https://programmingoneonone.com/hackerrank-sum-and-prod-problem-solution-in-python.html
import numpy
n,m = [int(x) for x in input().split()]
l =[] for i in range(n): l.append([int(x) for x in input().split()]) a = numpy.array(l) print(numpy.sum(a,axis =0).prod())
import numpy
n,m = map(int, input().split())
data = []
for _ in range(n): data.append(list(map(int, input().split())))
array = numpy.array(data)
col_sum = numpy.sum(array, axis=0) result = numpy.prod(col_sum) print(result)