Input Format
The first line contains two space separated integers,  and .
The next  lines contains  space separated integers of array .
The following  lines contains  space separated integers of array .
Output Format
Print the result of each operation in the given order under Task.

hackerrank array mathematics problem solution in python programming

Problem solution in Python 3 programming language.

import numpy
N, M = map(int, input().split())
A =  numpy.array([map(int, input().split()) for i in range(N)])
B =  numpy.array([map(int, input().split()) for i in range(N)])

print(A + B)
print(A - B)
print(A * B)
print(A / B)
print(A % B)
print(A ** B)

Second solution

import numpy as np
n, m = map(intinput().split())
a, b = (np.array([input().split() for _ in range(n)], 
dtype=intfor _ in range(2))
print(a+b, a-b, a*b, a//b, a%b, a**b, sep='\n')

Problem solution in Python 2 programming language.

import numpy
N, M = map(int, raw_input().split())
A =  numpy.array([map(int, raw_input().split()) for i in range(N)])
B =  numpy.array([map(int, raw_input().split()) for i in range(N)])

print A + B
print A - B
print A * B
print A / B
print A % B
print A ** B