input: Write a function to find the mode of the given set of values. The function should return the value that appears most frequently in the list.
  def find_mode(values):
    max_count = 0
    mode = values[0]
    count = {}
    for item in values:
      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([5, 5, 5, 4, 4, 4, 4])==4
  assert find_mode([10, 20, 30, 20, 10, 30, 40])==20
  assert find_mode([7, 7, 7, 7, 7])==7
  assert find_mode([8, 9, 8, 9, 8, 9, 8])==8
output: def find_mode(values):
    max_count = 0
    mode = values[0]
    count = {}
    for item in values:
      if (item in count):
        count[item] += 1
      else:
        count[item] = 1
      if (count[item] > max_count):
        max_count = count[item]
        mode = item
    return mode