In [ ]:
""" Implement the word_count function """

import unittest


def word_count(list_of_words):
    """ Create a function that takes a list of words.
    The return is a dict. Each key is a word in the sentence.
    The values is the frequency of each word in the sentence.
    """
    return dict() # TODO remove this line and add your implementation

# Tests below
# You can look, but don't touch!

class WordCountUnitTest(unittest.TestCase):
    """Test word_count"""
    
    def test_word_count(self):
        alt_fact = "I know words I have the best words"
        counts = word_count(alt_fact.split(" "))

        self.assertEqual(counts["I"], 2)
        self.assertEqual(counts["know"], 1)
        self.assertEqual(counts["words"], 2)
        self.assertEqual(counts["have"], 1)
        self.assertEqual(counts["the"], 1)
        self.assertEqual(counts["best"], 1)

suite = unittest.TestLoader().loadTestsFromTestCase(WordCountUnitTest)
unittest.TextTestRunner().run(suite)

In [ ]: