99% faster
\nclass NumArray:\n\n    def __init__(self, nums: List[int]):\n        self.nums=nums\n        self.total =sum(self.nums)\n        \n    def update(self, index:
```\nclass NumArray:\n\n    def __init__(self, nums: List[int]):\n        self.nums=nums\n        self.total =sum(self.nums)\n        \n    def update(self, index: int, val: int) -> None:\n        n = self.nums[index] \n        self.nums[index] = val\n        self.total = self.total - n + val\n            \n        \n    def sumRange(self, left: int, right: int) -> int:\n        n1 = sum(self.nums[0:left])\n        n2 = sum(self.nums[right+1:])\n        return  self.total -n1-n2\n        \n\n# Your NumArray object will be instantiated and called as such:\n# obj = NumArray(nums)\n# obj.update(index,val)\n# param_2 = obj.sumRange(left,right)\n```
['Python']