Answer:
def most_frequent_letter():
file = open("words","r")
dWords = {}
for line in file:
line = line.rstrip()
words = line.split(" ")
for word in words:
counts = {}
for c in word:
counts[c] = counts.get(c, 0) + 1
dWords[word] = max(counts, key=counts.get)
return dWords
print(most_frequent_letter())
Step-by-step explanation:
the file used was words in txt format and its contents are as follows:
hello aamir jan khan
parallelogram abdullah
anaconda ali
pycharm notebook