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
- Array Mathematics
- Discussions
Array Mathematics
Array Mathematics
Sort by
recency
|
334 Discussions
|
Please Login in order to post a comment
import numpy as np N, M = map(int, input().split()) A = np.array([list(map(int, input().split())) for _ in range(N)]) B = np.array([list(map(int, input().split())) for _ in range(N)]) print(A+B) print(A-B) print(A*B) print(A//B) print(A%B) print(A**B)
For Python3 Platform
import numpy as np
n = int(input().split()[0])
a, b = [np.array([input().split() for _ in range(n)], int) for _ in range(2)]
print(np.add(a, b), np.subtract(a, b), np.multiply(a, b), np.floor_divide(a, b), np.mod(a, b), np.power(a, b), sep='\n')