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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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 27 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 27 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.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply