input: Write a function that calculates the sum of a given list of numbers and returns the result. If the input list is empty, the function should return 0.
  
  
  def sum_list(arr):
      """Calculates the sum of a given list of numbers.
      
      Args:
          arr (list): List of numbers.
          
      Returns:
          int: Sum of list elements. If the list is empty, returns 0.
      """
      sum = 0
      for num in arr:
          sum += num
      return sum
  
  assert sum_list([1, 2, 3, 4, 5]) == 15
  assert sum_list([-1, -2, -3, -4, -5]) == -15
  assert sum_list([0, 0, 0]) == 0
  assert sum_list([]) == 0
  
output: def sum_list(arr):
      sum = 0
      for num in arr:
          sum += num
      return sum