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