Positive step
Input
iterate_with_range(0, 5)
Output
[0, 1, 2, 3, 4]
Numbers from 0 up to (but not including) 5 with step 1.
Full lesson preview
Generate sequences of integers using range parameters and loops.
Problem statement
Task
Examples
Input
iterate_with_range(0, 5)
Output
[0, 1, 2, 3, 4]
Numbers from 0 up to (but not including) 5 with step 1.
Input format
Output format
Constraints
Samples
Input
iterate_with_range(5, 0, -2)
Output
[5, 3, 1]
Start at 5, step -2, stop before reaching 0.