← Back to challenges

Pyramid Lists

PythonHardarrayslanguage_fundamentalsloops

Instructions

Given a number n, return a list containing several lists. Each list increments in size, from range 1 to n inclusive, contaning its length as the elements.

Examples

pyramid_lists(1) ➞ [[1]]

pyramid_lists(3) ➞ [[1], [2, 2], [3, 3, 3]]

pyramid_lists(5) ➞ [[1], [2, 2], [3, 3, 3], [4, 4, 4, 4], [5, 5, 5, 5, 5]]

Notes

n will be a positive integer.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Return the Total Number of Parameters