input: Write a function to calculate the average of a list of numbers. If the list is empty, return 0.
  def avg_list(lst):
   sum = 0
   count = 0
   for i in lst:
    sum += i
    count += 1
   if count == 0:
    return 0
   avg = sum / count
   return avg
  assert avg_list([3, 4, 5, 1, 2]) == 3.0
  assert avg_list([3, 5, 10, 1, 2]) == 4.2
  assert avg_list([4, 3, 1, 2]) == 2.5
  assert avg_list([3, 5, 4, 1, 2]) == 3.0
  assert avg_list([]) == 0
output: def avg_list(lst):
      if not lst:
          return 0
      return sum(lst) / len(lst)