Positive integers starting from 1 are arranged in lines. The i-th line has i numbers in it. For example, these would be the first four lines:
1 | 2, 3 | 4, 5, 6 |7, 8, 9, 10
Write a function that takes the argument "L" and returns the L-th line of this arrangement.
This was my approach:
def find_line(l):
array = []
x = 1
for i in range(1, l + 1):
while len(array) != I:
array.append(x)
x += 1
if i == l:
return array
else:
array = []