Attachment 'anna_solution.10.04.py'
Download 1 # ввести текст из файла anna.txt
2 # вывести самое популярное слово длиной больше 3 букв
3 # все небуквенные символы превращать в пробелы
4
5 f = open("anna.txt")
6 d = {}
7 text = "".join(c if c.isalpha() else " " for c in f.read())
8 for w in text.split():
9 if len(w)>3:
10 d[w] = d.get(w, 0)+1
11
12 print(d)
13 for e in d:
14 if d[e] == m:
15 print(e,m)
16 break
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.- [get | view] (2017-07-23 17:39:41, 0.5 KB) [[attachment:anna_solution.10.04.py]]
- [get | view] (2017-07-23 17:12:50, 0.4 KB) [[attachment:anna_solution_10.03.py]]
You are not allowed to attach a file to this page.