input: Write a function to correct the given Python code by fixing any bugs. The function should correctly sum all elements in a list and return the total sum. If the input list is empty, it should return 0. 
  
  ### Function Header:
  def sum_list(list):
      sum_list = 0
      for num in list:
          sum_list += num
      return sum_list
  
  ### Assert Test Cases:
  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, 0]) == 0
  assert sum_list([]) == 0
output: def sum_list(list):
      total_sum = 0
      for num in list:
          total_sum += num
      return total_sum