What words do three text files have in common?
A word in a text is defined as the longest sequence of letters, where every character that is not a letter is considered a word boundary.
Write a function common_words
that takes the locations of three text files (str
). The function must return a set
containing the words that occur in all three text files. The function must return a set
containing the words that occur in all three text files. The function may not make a distinction between uppercase and lowercase letters, and the words in the set
must be lowercase.
In the following interactive session we assume the text files data_a.txt
1, data_b.txt
2 and data_c.txt
3 to be located in the current directory.
>>> common_words('data_a.txt', 'data_b.txt', 'data_c.txt')
{'and', 'as', 'he'}