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
|
331 Discussions
|
Please Login in order to post a comment
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')
import numpy as np
n, m = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(n)]
B = [list(map(int, input().split())) for _ in range(n)]
a = np.array(A) b = np.array(B)
print(a + b) print(a - b) print(a * b) print(a // b) print(a % b) print(a ** b)
My compact solution…