input: Write a function to identify and fix any bugs in the provided Python code for summing elements in a list. The function should take a list of numbers as input, calculate their sum, and return the result. If the given list is empty, the function should return 0.
  assert sum_list([1, 2, 3, 4]) == 10
  assert sum_list([-1, 0, 1]) == 0
  assert sum_list([10, 20, 30]) == 60
  assert sum_list([0, 0, 0]) == 0
  assert sum_list([]) == 0
output: def sum_list(numbers):
      if not numbers:
          return 0
      return sum(numbers)