Goal:
Your goal is to print out numbers within a given range (Also including given values).
Input Format:
The input will look like:
(int-int, int-int, ...)
...
meaning the user can add as many int-int
as they'd like.
Other Info:
- You will only have to handle non-negative integer numbers.
- The first integer in
int-int
will always be smaller, or the same, then the next integer inint-int
- The input will always have at least two
int-int
- Each
int-int
will followed by a comma and a space, except for the last one. - This is code-golf meaning the shortest answer wins!
Examples / Test Cases:
- Example 1:
- Input:
(10-13, 11-15, 0-3)
Output:
10 11 12 13 11 12 13 14 15 0 1 2 3
Example 2:
- Input:
(1-5, 1-15)
Output:
1 2 3 4 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Example 3:
- Input:
(1-2, 1-3, 1-3, 1-2)
Output:
1 2 1 2 3 1 2 3 1 2
Example 4:
- Input:
(4-6, 0-1, 9-9)
- Output:
4 5 6 0 1 9
(
and the,
or can we take an array ofn-n
for the input? \$\endgroup\$(
,,
,)
too. \$\endgroup\$11-10
would give11 10
I'd recommend adding a test case for that and for when the integers are the same (e.g.10-10
-- though I'd imagine this would give10
) \$\endgroup\$8-8
=>8
). \$\endgroup\$-←{(⊃~⍨/⍳¨⍺,1+↑⍵),1↓⍵}
. Now(10-13, 11-15, 0-3)
evaluates to10 11 12 13 11 12 13 14 15 0 1 2 3
! \$\endgroup\$