Task-
In the given array or matrix, we have to subtract number in each elements of the array.
Example-
array is [1 2 3 4]
then array-1 will give [0 1 2 3]
program-
#import numpy
import numpy as np
l=[1,2,3,4,5]
arr=np.array(l)
print("Matrix is :",arr)
print("After Subtract 1 :",arr-1)
l=[[1,2,3],[4,5,1],[1,1,0]]
arr=np.array(l)
print("nMatrix is :n",arr)
print("After Subtract 2 :n",arr-2)
Matrix is : [1 2 3 4 5]
After Subtract 1 : [0 1 2 3 4]
Matrix is :
[[1 2 3]
[4 5 1]
[1 1 0]]
After Subtract 2 :
[[-1 0 1]
[ 2 3 -1]
[-1 -1 -2]]