Array Mathematics

  • [deleted]Challenge Author
    + 0 comments

    For Python3

    import numpy as np
    
    n, m = map(int, input().split())
    A = []
    B = []
    
    for i in range(n):
        A.append([*map(int, input().split())])
    for j in range(n):
        B.append(list(map(int, input().split())))
    
    A = np.array(A)
    B = np.array(B)
    
    print(np.add(A, B))
    print(np.subtract(A, B))
    print(np.multiply(A, B))
    print(np.floor_divide(A, B))
    print(np.mod(A, B))
    print(np.power(A, B))