input: Write a function to find the list of words that appear at least n times in a given list of words using Python. The function should take two arguments: a list of words and an integer n. If the input list is empty, return an empty list.
  assert frequent_words(['a', 'b', 'a', 'c', 'd', 'a', 'x', 'd', 'd'], 3)==['a', 'd']
  assert frequent_words(['a', 'b', 'a', 'c', 'd'], 2)==['a']
  assert frequent_words(['a', 'a', 'a'], 3)==['a']
  assert frequent_words([], 1)==[]
  assert frequent_words(['x', 'y', 'z'], 2)==[]
output: def frequent_words(words, n):
      if not words:
          return []
      word_count = {}
      for word in words:
          if word in word_count:
              word_count[word] += 1
          else:
              word_count[word] = 1
      result = [word for word, count in word_count.items() if count >= n]
      return result