vectorize() (NumPy)

np.vectorize() wraps an ordinary Python function so it can be called on whole arrays, applying it element by element and handling broadcasting. It is a…