input: Write a function to find the maximum sum of a subarray using a nested loop.
  assert max_sum([1, -3, 7, 12, -4, 8]) == 23
  assert max_sum([-2, 1, -3, 4, -1, 2, 1, -5, 4]) == 6
  assert max_sum([5, -4, -2, 6, -1]) == 6
output: def max_sum(arr):
      max_sum = float('-inf')
      n = len(arr)
      
      for i in range(n):
          current_sum = 0
          for j in range(i, n):
              current_sum += arr[j]
              if current_sum > max_sum:
                  max_sum = current_sum
                  
      return max_sum