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([0, 0, 0, 0])==0
  assert sum_list([])==0
output: def sum_list(lst):
      return sum(lst) if lst else 0