Here we can use the np.isscalar method in order to verify the value of the variable NBins is whether it is a scalar or an array.

The code for implementation is given below which will take into consideration the following:

1. Determine whether NBins is a scalar or an array.

2. Print the length of the array in that case.

*import numpy as np*

*def input_bins(NBins):*

* if np.isscalar(NBins):*

* print(“NBins is a scalar, NBins”). *

* else:*

* try:*

* length = len(NBins).*

* print(“NBins is an array with length:”, length)*

* except TypeError: *

* print(“NBins does not comprise of scalar or array like objects”).*

*input_bins(50)*

*input_bins([0, 10, 20, 30])*