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
|
355 Discussions
|
Please Login in order to post a comment
easy two liner:
import numpy N, M = list(map(int, input().split())) my_array = numpy.array([input().strip().split()[:M] for _ in range(N)], dtype=numpy.int32) print(numpy.prod(numpy.sum(my_array, axis=0)))
import numpy as np
n,m = map(int, input().split()) a= [] for i in range(n): a.append(list(map(int, input().split()))) print(np.prod(np.sum(a, axis = 0)))
import numpy as np
n, m = list(map(int, input().strip().split()))
arr = np.array([input().strip().split() for _ in range(n)], dtype=np.int32) print(np.prod(np.sum(arr, axis=0)))
N,M = list(map(int,input().split())) A = [list(map(int,input().split())) for _ in range(N)] print(numpy.prod(numpy.sum(A,axis=0)))