Can anybody tell me why my code below does not work?

```
class NumArray(object):
_dp = []
def __init__(self, nums):
self._dp.append(0)
for i in range(0, len(nums) ):
self._dp.append( self._dp[-1] + nums[i] )
def sumRange(self, i, j):
return self._dp[j+1] - self._dp[i]
Input: [-1], sumRange(0,0)
Output: [-2]
Expected: [-1]
```

If I move the first line "_dp = [ ]" into the **init** as " self._dp = [ ]", the code works. Does any member have to be initialized in **init** and with the "self." prefix? I am newbie of Python, forgive me if the question is too simple.

Thanks in advance!