input: Write a function to identify and correct any bugs in the given Python code. The function should take a list as input, calculate the sum of all elements in the list, and return the sum. Ensure that the function returns the correct sum and does not have any syntax errors or logical issues.
  def sum_list(list):
      sum_list = 0
      for num in list:
          sum_list += num
      return sum_list
  
  assert sum_list([1, 2, 3, 4])==10
  assert sum_list([0, 0, 0])==0
  assert sum_list([-1, -2, -3])==-6
  assert sum_list([])==0
output: def sum_list(input_list):
      total_sum = 0
      for num in input_list:
          total_sum += num
      return total_sum