input: Write a function to calculate the sum of all elements in a given list. The function should take a list as input and return the sum of its elements. If the list is empty, the function should return 0.
  assert sum_list([1, 2, 3, 4, 5])==15
  assert sum_list([5])==5
  assert sum_list([])==0
  assert sum_list([-1, -2, -3])==-6
  assert sum_list([1.5, 2.5, 3.5])==7.5
output: def sum_list(lst):
      if not lst:
          return 0
      return sum(lst)