input: Write a function to return a list of words that appear at least n times in a given list of words.
  assert frequent_words(['a', 'b', 'a', 'c', 'd', 'a', 'x', 'd', 'd'], 3)==['a', 'd']
  assert frequent_words(['apple', 'banana', 'apple', 'banana', 'apple'], 2)==['apple', 'banana']
  assert frequent_words(['cat', 'dog', 'cat', 'cat', 'dog', 'cat', 'cat'], 4)==['cat']
  assert frequent_words(['x', 'y', 'z'], 2)==[]
  assert frequent_words([], 1)==[]
output: def frequent_words(words, n):
      word_count = {}
      for word in words:
          if word in word_count:
              word_count[word] += 1
          else:
              word_count[word] = 1
      return [word for word, count in word_count.items() if count >= n]