In this NumPy tutorial, you’ll learn how to use the NumPy arange function in Python. In the following example, this function will create a NumPy array of numbers with a step size of 4. All the numbers will be between 0 and 20. A number 0 will be included and a number 20 will be excluded.
# import numpy module import numpy as np # create a numpy array var = np.arange(0, 20, 4) # print the array print(var)
Output:
[ 0 4 8 12 16]
Free resources to learn advanced skills: AiHints and CodeAllow