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
|
371 Discussions
|
Please Login in order to post a comment
My compact solution…
If the
import
lines didn't count, this could be considered a one-liner.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())