Answer:
from collections import Counter
text_holder = [ ]
with open( " file_name", "r") as file:
while file:
reader = file.readlines()
line_split = reader.split(" ")
for word in line_split:
text_holder.append( word )
file.close()
counter = Counter( text_holder )
for key, value in counter.items():
pair = [ key, value]
print( set( pair ) )
Explanation:
The python source code above uses an imported python module called Counter from the collections package to convert the list " text_holder" into a counted dictionary, with each unique word from the text file as the key and it frequency as the value.