04. [25p] Word Map

First, take a couple (3-4) of paragraphs from here and store them inside a .txt file.

  • Open the file and read its contents into string;
  • Build a dict with each word from this text (lower cased as key), counting their frequency (as its value);
  • Use it to print out the most frequent 5 words in this text (together with their value!), e.g.:
[('the', 29), ('of', 18), ('and', 15), ('to', 10), ('a', 9)]
ii/labs/s2/01/tasks/04.txt ยท Last modified: 2024/03/15 13:30 by florin.stancu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0