в Python. Есть файл с каким то текстом и нужно найди самое часто встречающееся слово.
196
495
Ответы на вопрос:
Python 3.7.2
def readFile(file):
with open(file, 'r', encoding = 'utf-8') as file:
text = file.readlines()
return text
file = input('Enter path to file: ')
text = ' '.join(readFile(file))
most_word = ['', 0]
for word in text.split(' '):
if most_word[1] < text.count(word):
most_word[0] = word; most_word[1] = text.count(word)
print(most_word)
//прога на pascal`e var x: real; function f (a: real): real; begin f: = (sqr(cos(a)) - 5) / (abs(a) + 3); end; begin write ('введите x: '); readln (x); write ('a = ', f(x)); end.
Популярно: Информатика
-
Skrilleax9528.03.2021 12:27
-
ychenicaa706.03.2020 04:21
-
dhgdfnhflk13.05.2021 06:42
-
tarantilla09.06.2023 21:00
-
Викушка11111108.01.2020 04:22
-
Макс1111111f06.01.2023 15:29
-
Gollagan06.12.2022 15:08
-
никита15485607.01.2022 01:21
-
hdbhbd21.12.2021 00:02
-
mar24414408.08.2022 06:22