We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import numpy as np
elements = input().split() int_elements = list(map(int, elements))
n_A = [] for i in range(int_elements[0]): n_A.append(list(map(int, input().split())))
m_B = [] for i in range(int_elements[0]): m_B.append(list(map(int, input().split())))
a = np.array(n_A) b = np.array(m_B)
print(np.add(a, b)) print(np.subtract(a, b)) print(np.multiply(a, b)) print(np.floor_divide(a, b)) # Perform integer division print(np.mod(a, b)) print(np.power(a, b))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
import numpy as np
Input the number of rows and columns
elements = input().split()
int_elements = list(map(int, elements))
Input first matrix
n_A = []
for i in range(int_elements[0]):
n_A.append(list(map(int, input().split())))
Input second matrix
m_B = []
for i in range(int_elements[0]):
m_B.append(list(map(int, input().split())))
Convert the lists to NumPy arrays
a = np.array(n_A)
b = np.array(m_B)
Perform element-wise operations and print the results
print(np.add(a, b))
print(np.subtract(a, b))
print(np.multiply(a, b))
print(np.floor_divide(a, b)) # Perform integer division
print(np.mod(a, b))
print(np.power(a, b))
The text was updated successfully, but these errors were encountered: