Question: the purpose of the below function is to return:

```
> f(0) returns [], 
> f(1) returns [[1]]
> f(2) returns [[1], [1,2]] 
> f(3) returns [[1], [1,2], [1,2,3]]

```

how can it be improved?

```
def list_generator(number: int) -> list:
    if number == 0:
        new_list = []
    else:
        temp_list = []
        new_list = [0] * number
        for idx, num in zip(range(len(new_list)), range(1, number + 1)):
            temp_list.append(num)
            new_list[idx] = list(set(temp_list))

    return new_list

```

Answer: 
```
def f(n):
    return [[x + 1 for x in range(i)] for i in range(1, n + 1)]

for n in range(6):
    print(n, f(n))
# 0 []
# 1 [[1]]
# 2 [[1], [1, 2]]
# 3 [[1], [1, 2], [1, 2, 3]]
# 4 [[1], [1, 2], [1, 2, 3], [1, 2, 3, 4]]
# 5 [[1], [1, 2], [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5]]

```
You can use a list comprehension:

```
def f(number: int) -> list:
    return [list(range(1, i+1)) for i in range(1, number+1)]

```