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.

You are not allowed to attach a file to this page.