input: Write a function to find and fix any bugs in the given Python code. Specifically, the function should correct any issues in the implementation of the `sum_list` function which calculates the sum of elements in a list. If the code is fixed correctly, it should pass the following test cases:
  
  assert sum_list([1, 2, 3, 4]) == 10
  assert sum_list([0, -1, 1]) == 0
  assert sum_list([]) == 0
  assert sum_list([5]) == 5
  assert sum_list([-5, 5]) == 0
output: def sum_list(lst):
      total = 0
      for num in lst:
          total += num
      return total