input: Write a function to calculate the Inverse Document Frequency (IDF) for a given set of documents.
  assert calculate_idf(["this is a test", "this test is a test"]) == {'this': 0.0, 'is': 0.0, 'a': 0.0, 'test': 0.0}
  assert calculate_idf(["the cat sat on the mat", "the cat ate the rat", "the dog chased the cat"]) == {'the': 0.0, 'cat': 0.0, 'sat': 1.0986122886681098, 'on': 1.0986122886681098, 'mat': 1.0986122886681098, 'ate': 1.0986122886681098, 'rat': 1.0986122886681098, 'dog': 1.0986122886681098, 'chased': 1.0986122886681098}
output: import math
  
  def calculate_idf(documents):
      N = len(documents)
      word_doc_count = {}
      for doc in documents:
          words = set(doc.split())
          for word in words:
              if word not in word_doc_count:
                  word_doc_count[word] = 1
              else:
                  word_doc_count[word] += 1
                  
      idf = {}
      for word, count in word_doc_count.items():
          idf[word] = math.log(N / count)
          
      return idf