9951 explained code solutions for 126 technologies


python-numpyNumpy broadcasting example


import numpy as np

a = np.array([1, 2, 3])
b = 3

result = a * bctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

a * b

during this operation b value will be broadcasted to all values of a array