Google News
logo
NumPy - Interview Questions
What is the difference between range() and arange() functions in Python?
The main difference is that the arange function is a built function in the python class that helps generate a sequence of integer values within a certain range. However, the arange function is a built-in function in the python library called Numpy, and so to use the arange function, you will have to install the NumPy package. Both range and arange functions take the same parameters shown below. (start, stop, and step). The main difference is that the range function takes only integers arguments. Otherwise, it returns an error message while the arange function will generate or return an instance of the NumPy ndarray.
 
* range([start], stop[, step])
 
* numpy.arange([start, ]stop, [step, ]dtype=None)
Advertisement