input: Write a function to return a list of words that appear at least n times in the given list. 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', 'b', 'c'], 2)==['a', 'b']
  assert frequent_words(['a', 'a', 'a', 'a'], 4)==['a']
  assert frequent_words(['a', 'b', 'c'], 2)==[]
  assert frequent_words([], 1)==[]
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
      return [word for word in word_count if word_count[word] >= n]