In this HackerRank Array Mathematics problem solution, you are given two integer arrays A and B of dimensions N x M. and your task is to perform the operations on the arrays.

HackerRank Array Mathematics in python problem solution

HackerRank Array Mathematics in python problem solution

import numpy as np
[N,M]=list(map(int,input().split()))
L1,L2 = [],[]
for i in range(N):
    L1.append(list(map(int,input().split())))
for i in range(N):
    L2.append(list(map(int,input().split())))
npArr1 = np.array(L1)
npArr2 = np.array(L2)
print(np.add(npArr1,npArr2))
print(np.subtract(npArr1,npArr2))
print(np.multiply(npArr1,npArr2))
print(np.floor_divide(npArr1,npArr2))
print(np.mod(npArr1,npArr2))
print(np.power(npArr1,npArr2))