Run
import numpy as np #2D array arr = (np.arange(8)*2).reshape(2,4) #print array print("The array\n", arr) #multiplying a constant to all the elements of array output = arr * 3 print("\nAfter multiplying a constant to all the elements of array\n", output)
Output