How can I make a function that will create a list, increasing the amount of numbers it contains each time to a specified value?
For example if the max was 4, the list would contain
1, 2, 2, 3, 3, 3, 4, 4, 4, 4
It’s difficult to explain what I’m looking for, but from the example I think you’ll understand!
Thanks
A Nested loop.
This would be a very basic way to do it.
There are much better ways, this should give you the general idea.
Here is doing it with list comprehension:
Using extend as suggested.