Given the input of n
and value
. The code is supposed to nest the single element list with value
repeated n
times. The final output should be a multilevel nested list with single repeated values in all sublists.
This is code-golf, so the shortest code in bytes wins!
Test cases:
n = 1, value = 'a': ['a']
n = 2, value = 'a': ['a', ['a']]
n = 3, value = 'a': ['a', ['a', ['a']]]
n = 4, value = 'a': ['a', ['a', ['a', ['a']]]]
n = 5, value = 'a': ['a', ['a', ['a', ['a', ['a']]]]]
n = 6, value = 'a': ['a', ['a', ['a', ['a', ['a', ['a']]]]]]
n
always greater than zero? If so, can we taken
0-indexed? \$\endgroup\$0
\$\endgroup\$