input: Write a function that takes a list containing fruit names and returns the most common fruit name. If there are ties for the most common fruit, the function should return the first one encountered with the highest frequency.
  
  def most_common_fruit(fruit_list):
      freq_dict = {}
      for fruit in fruit_list:
          if fruit in freq_dict:
              freq_dict[fruit] += 1
          else:
              freq_dict[fruit] = 1
      max_freq = 0
      for freq in freq_dict.values():
          if freq > max_freq:
              max_freq = freq
      most_common_fruit = None
      for fruit, freq in freq_dict.items():
          if freq == max_freq:
              most_common_fruit = fruit
              break
      return most_common_fruit
  
  assert most_common_fruit(['Apple', 'Orange', 'Apple', 'Pineapple', 'Grape', 'Apple'])=='Apple'
  assert most_common_fruit(['Banana', 'Banana', 'Cherry', 'Cherry', 'Cherry'])=='Cherry'
  assert most_common_fruit(['Mango', 'Mango', 'Apple', 'Apple', 'Apple'])=='Apple'
  assert most_common_fruit(['Kiwi', 'Kiwi', 'Kiwi', 'Orange', 'Orange'])=='Kiwi'
  assert most_common_fruit([])==None
output: def most_common_fruit(fruit_list):
      freq_dict = {}
      for fruit in fruit_list:
          if fruit in freq_dict:
              freq_dict[fruit] += 1
          else:
              freq_dict[fruit] = 1
      max_freq = 0
      for freq in freq_dict.values():
          if freq > max_freq:
              max_freq = freq
      most_common_fruit = None
      for fruit, freq in freq_dict.items():
          if freq == max_freq:
              most_common_fruit = fruit
              break
      return most_common_fruit