input: Write a function to find the mode of the given set of values. The mode is the value that appears most frequently in the list. If there is a tie for the most frequent value, return the first one encountered in the list. If the list is empty, return None.
  
  def find_mode(list):
      if not list:
          return None
      max_count = 0
      mode = None
      count = {}
      for item in list:
          if item in count:
              count[item] += 1
          else:
              count[item] = 1
          if count[item] > max_count:
              max_count = count[item]
              mode = item
      return mode
  
  assert find_mode([1, 2, 3, 2, 4, 2])==2
  assert find_mode([6, 3, 9, 6, 6, 5, 9, 3])==6
  assert find_mode([7, 8, 9])==7
  assert find_mode([10, 10, 10, 20, 20, 20, 30, 30, 30])==10
  assert find_mode([])==None
output: def find_mode(list):
      if not list:
          return None
      max_count = 0
      mode = None
      count = {}
      for item in list:
          if item in count:
              count[item] += 1
          else:
              count[item] = 1
          if count[item] > max_count:
              max_count = count[item]
              mode = item
      return mode