Write a NumPy program to add two arrays A and B of sizes (3,3) and (,3).
import numpy as np A = np.ones((3,3)) B = np.arange(3) print("Original array:") print("Array-1") print(A) print("Array-2") print(B) print("A + B:") new_array = A + B print(new_array)
Sample Output:
Original array: Array-1 [[1. 1. 1.] [1. 1. 1.] [1. 1. 1.]] Array-2 [0 1 2] A + B: [[1. 2. 3.] [1. 2. 3.] [1. 2. 3.]]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer