input: Write a function to correct any bugs in the given Python code. The code should correctly compute the sum of elements in a list and return the result. If the given list is empty, it should return 0.
  assert sum_list([1, 2, 3, 4])==10
  assert sum_list([10, 20, 30])==60
  assert sum_list([-1, -2, -3, -4])==-10
  assert sum_list([])==0
output: def sum_list(lst):
      if not lst:
          return 0
      return sum(lst)