Sum of all arguments ever passed to accumulator
An alternative to the closure is to add an attribute to the function, so rather than:

lst = []
def accumulate(n):
    lst.append(n)
    ...


you have:

def accumulate(n):
    accumulate.lst.append(n)
    ...
accumulate.lst = []


It's a little more typing, but one advantage is that it allows easier access to the list so far from outside the function:

&gt;&gt;&gt; accum = make_accumulator()
&gt;&gt;&gt; accum(7)
7
&gt;&gt;&gt; accum(8)
15
&gt;&gt;&gt; accum.lst
[7, 8]


With the closure, this would be accum.func_closure[0].cell_contents.



Using indices is not a very Pythonic way to handle iterating over a list, and x = x + y can be simplified to x += y; compare:

...
length = len(lst)
for index in range(length):
    total = total + lst[index]
...


with:

...
for item in lst:
    total += item
...


There is also sum(lst), which the specification doesn't forbid.




  How can I think of writing pure functional code for above program
  (i.e., without any state change)?


I don't think that this can be achieved in a purely functional way as specified - you are explicitly told to use a list to store the values passed, so there will always be state, and the function you create will give different outputs for the same inputs depending on the previous inputs (no referential transparency).