input: Write a function to calculate the sum of all the elements in a given list. If the list is empty, return 0.
  def sum_list(lst):
    total = 0
    for num in lst:
      total += num
    return total
  
  assert sum_list([1, 2, 3, 4, 5])==15
  assert sum_list([10, 20, 30])==60
  assert sum_list([-1, 0, 1])==0
  assert sum_list([])==0
  assert sum_list([7])==7
output: def sum_list(lst):
    total = 0
    for num in lst:
      total += num
    return total