How to Generate Range of Integers in Python
The challenge
Implement a function named generateRange(min, max, step), which takes three arguments and generates a range of integers from min to max, with the step. The first integer is the minimum value, the second is the maximum of the range and the third is the step. (min < max)
Task
Implement a function named
Note
- min < max
- step > 0
- the range does not HAVE to include max (depending on the step)
The solution in Python code
Option 1:
Option 2:
Option 3:
|
|
Test cases to validate our solution
|
|