input: Write a function to calculate the sum of all elements in a given list and return it. If the list is empty, return 0. The function should be named sum_list with a single parameter input_list which is expected to be a list of numbers.
  assert sum_list([1, 2, 3, 4, 5])==15
  assert sum_list([-1, 0, 1])==0
  assert sum_list([10, 20, 30, 40])==100
  assert sum_list([])==0
  assert sum_list([5])==5
output: def sum_list(input_list):
      if not input_list:
          return 0
      return sum(input_list)