input: Write a function to fix any bugs in the given Python code that calculates the sum of a list. If the input list is empty, return 0.
  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
  assert sum_list([])==0
  assert sum_list([1])==1
output: def sum_list(lst):
      if not lst:
          return 0
      return sum(lst)