Page 1 of 1

12.7 LAB 12 - Part 2: File 1/0 and word frequencies Write a program that first reads in the name of an input file and th

Posted: Mon May 09, 2022 7:07 am
by answerhappygod
12 7 Lab 12 Part 2 File 1 0 And Word Frequencies Write A Program That First Reads In The Name Of An Input File And Th 1
12 7 Lab 12 Part 2 File 1 0 And Word Frequencies Write A Program That First Reads In The Name Of An Input File And Th 1 (62.52 KiB) Viewed 28 times
12 7 Lab 12 Part 2 File 1 0 And Word Frequencies Write A Program That First Reads In The Name Of An Input File And Th 2
12 7 Lab 12 Part 2 File 1 0 And Word Frequencies Write A Program That First Reads In The Name Of An Input File And Th 2 (53.13 KiB) Viewed 28 times
in python please thanks!!!
12.7 LAB 12 - Part 2: File 1/0 and word frequencies Write a program that first reads in the name of an input file and then reads the file. The input file contains words, each on a separate line. You'll need to remove the newline at the end of each line (see note below). Using a dictionary, keep track of the word and frequency of each word (the number of times each word appears in the file). Output each word and frequency, one word per line, to a file named 'myfile.txt'. Ex: If the input is: inputl.txt and the contents of input1.txt are: hello cat man hey dog boy Hello man cat woman dog Cat hey boy
the file myfile.txt should contain: hello 1 cat 2 man 2 hey 2. dog 2 boy 2. Hello 1 woman 1 Cat 1 Note: There is a newline at the end of each line of the input file, requiring you to strip('\n') from each line before you add it to your dictionary. input1.txt is available to download.