input: Write a python function to calculate the prefix sum of an array.
  assert prefix_sum([1, 2, 3, 4]) == [1, 3, 6, 10]
  assert prefix_sum([5, 10, 15, 20]) == [5, 15, 30, 50]
  assert prefix_sum([1, -1, 1, -1]) == [1, 0, 1, 0]
output: def prefix_sum(arr):
      prefix_sums = []
      current_sum = 0
      for num in arr:
          current_sum += num
          prefix_sums.append(current_sum)
      return prefix_sums