Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open("source.txt") as f:
- data = f.read()
- words = data.split()
- word_dict = dict()
- for word in words:
- if word in word_dict:
- word_dict[word] += 1
- else:
- word_dict[word] = 1
- max = 0
- for key, value in word_dict.items():
- if value > max:
- max = value
- moda = []
- for key, value in word_dict.items():
- if value == max:
- moda.append(key)
- print(max)
- for el in moda:
- print(el)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement