input: Write a function to find the mode of a given list of numbers. If there are multiple modes, return the first one encountered. The function should return the mode as an integer.
  
  assert find_mode([1, 2, 3, 2, 4, 2])==2
  assert find_mode([4, 4, 1, 1, 4, 2, 3, 4])==4
  assert find_mode([6, 8, 8, 6, 6])==6
  assert find_mode([7, 7, 7, 7])==7
  assert find_mode([5])==5
output: def find_mode(nums):
      count = {}
      for num in nums:
          if num in count:
              count[num] += 1
          else:
              count[num] = 1
      return max(nums, key=count.get)