I have a function that takes a list as parameter (have used a very simple function here to focus on the point of my question).
def some_lst_func(lst):
foo = len(lst)
return foo
lst1= [1, 6, 6, 7, 7, 5]
print(some_lst_func(lst1))
For the whole list this works fine, but I want to incrementally pass the list ([1], [1,6].....) to the function and record each output (i.e. increasing length of list).
Below is what I have tried but is clearly not correct, and not sure what the output is that I am getting, what I would expect is
1
2
3...
for num in lst1:
print(some_lst_func(lst1[:num]))