input: Write a function to calculate the TF-IDF score for a given term in a document.
  assert tf_idf_score('sentence', ['this', 'is', 'a', 'sentence'], [['this', 'is', 'a', 'sentence'], ['this', 'is', 'another', 'sentence'], ['this', 'sentence', 'is', 'irrelevant']]) == 0.0
  assert tf_idf_score('this', ['this', 'is', 'a', 'sentence'], [['this', 'is', 'a', 'sentence'], ['this', 'is', 'another', 'sentence'], ['this', 'sentence', 'is', 'irrelevant']]) == 0.0
  assert tf_idf_score('irrelevant', ['this', 'sentence', 'is', 'irrelevant'], [['this', 'is', 'a', 'sentence'], ['this', 'is', 'another', 'sentence'], ['this', 'sentence', 'is', 'irrelevant']]) == 0.34657359027997264
output: import math
  
  def tf_idf_score(term, document, corpus):
      # Term Frequency (TF)
      term_count = document.count(term)
      total_terms = len(document)
      tf = term_count / total_terms if total_terms != 0 else 0
  
      # Inverse Document Frequency (IDF)
      num_docs_with_term = sum(1 for doc in corpus if term in doc)
      num_docs = len(corpus)
      idf = math.log(num_docs / num_docs_with_term) if num_docs_with_term != 0 else 0
  
      # TF-IDF Score
      tf_idf = tf * idf
      return tf_idf