Array Mathematics

  • + 0 comments

    import numpy N, M = map(int, input().strip().split()) arr_1 = numpy.array([input().strip().split() for _ in range(N)][:M], dtype=numpy.int_) arr_2 = numpy.array([input().strip().split() for _ in range(N)][:M], dtype=numpy.int_) print(numpy.add(arr_1, arr_2)) #arr_1 + arr_2 print(numpy.subtract(arr_1, arr_2)) #arr_1 - arr_2 print(numpy.multiply(arr_1, arr_2)) #arr_1 * arr_2 print(numpy.floor_divide(arr_1, arr_2)) #arr_1 // arr_2 print(numpy.mod(arr_1, arr_2)) #arr_1 % arr_2 print(numpy.power(arr_1, arr_2)) #arr_1 ** arr_2