6 kyu
The range() function
2,049 of 2,136user5363957
Description:
Let's implement the range function:
range([start], stop, [step])
range(1, 11);
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
range(1, 4, 0); // /!\ note that the step is 0
=> [1, 1, 1]
range(0);
=> []
range(10, 0); // /!\ note that the end is before the start
=> []
range(10);
=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
range(0, 30, 5);
=> [0, 5, 10, 15, 20, 25]
start, if omitted, defaults to 0; step defaults to 1.
Returns a list of integers from start to stop, incremented by step, exclusive.
Note that ranges that stop before they start are considered to be zero-length instead of negative.
Fundamentals
Similar Kata:
Stats:
Created | Nov 29, 2013 |
Published | Nov 29, 2013 |
Warriors Trained | 4590 |
Total Skips | 711 |
Total Code Submissions | 13914 |
Total Times Completed | 2136 |
JavaScript Completions | 2049 |
Go Completions | 69 |
Total Stars | 77 |
% of votes with a positive feedback rating | 81% of 246 |
Total "Very Satisfied" Votes | 180 |
Total "Somewhat Satisfied" Votes | 40 |
Total "Not Satisfied" Votes | 26 |