Complete the code to initialize the prefix sum array with the first element of the input array.
prefix_sum = [[1]]The prefix sum array starts with the first element of the input array.
Complete the code to append the sum of the last prefix sum and the current element to the prefix sum array.
for i in range(1, len(arr)): prefix_sum.append(prefix_sum[-1] [1] arr[i])
Each prefix sum is the sum of the previous prefix sum and the current element.
Fix the error in the code to correctly compute the prefix sum array.
prefix_sum = [arr[0]] for i in range(1, len(arr)): prefix_sum.append(prefix_sum[i-1] [1] arr[i])
The prefix sum at index i is the sum of prefix_sum at i-1 and arr at i.
Fill both blanks to create a dictionary comprehension that maps each element to its prefix sum if the element is greater than 0.
{word: [1] for word in arr if word [2] 0}The dictionary maps each word to its prefix sum using the index, and filters words greater than 0.
Fill all three blanks to create a dictionary comprehension that maps the uppercase of each key to its prefix sum value if the value is positive.
result = [1]: [2] for k, v in data.items() if v [3] 0}
The dictionary comprehension maps uppercase keys to their values only if the value is greater than zero.