input: Write a function to fix the given Python code so that it correctly sums up all the elements in the provided list. The function should return the sum of all elements in the list. If the list is empty, return 0.
  
  assert sum_list([1, 2, 3]) == 6
  assert sum_list([-1, 0, 1]) == 0
  assert sum_list([10]) == 10
  assert sum_list([]) == 0
output: def sum_list(lst):
      if not lst:
          return 0
      return sum(lst)