Question
Answered step-by-step

7.8 LAB: Word frequencies (lists) Write a program that first reads...

7.8 LAB: Word frequencies (lists)

Write a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of words separated by commas. Your program should output the words and their frequencies (the number of times each word appears in the file) without any duplicates.

Ex: If the input is:

input1.csv

and the contents of input1.csv are:

hello,cat,man,hey,dog,boy,Hello,man,cat,woman,dog,Cat,hey,boy

the output is:

hello 1
cat 2
man 2
hey 2
dog 2
boy 2
Hello 1
woman 1
Cat 1

Answer & Explanation
Verified Solved by verified expert
Rated Helpful

ctum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet

trices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam

Unlock full access to Course Hero

Explore over 16 million step-by-step answers from our library

Subscribe to view answer
Step-by-step explanation

ongue vel laoreet ac

, dictum vitae odio. D


ac, dictum vit


ec facilisis. Pel


suff1.png



inia pulvinar to


usce dui l

gue vel laoreet ac, dictu

itur laoreet. Nam risus ante, dapibus a m

fficitur laoreet. Nam risus ante, dapibus a molest

sum dolor sit amet,

gue vel laoreet a

rem ipsum dolor sit amet, consectetu

a molestie consequat, ultrices ac magna

ec facilisis. Pellentesque dapibus e

risus ante, dapibus a molesti

fficitur laoreet. Nam risus ante, d

lestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet

m risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce

sus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui

itur laoreet. Nam risus ante, dapibus a molestie consequat, ultri

e vel laoreet ac, dictum vitae odio.

s a molestie consequat, ultrices ac magna. Fusce dui lectus, congue v

ongue vel laoreet a

sus ante, dapibus a molestie cons

icitur laoreet. Nam risus ante, dapibus a molestie consequa


ac, dictum vit


pulvinar tortor nec facilisis. Pellentesque dapibus effici


suff2.png


Donec


suff3.png



ec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing eli

3 Attachments
suff1.png
png
suff2.png
png
suff3.png
png
Student reviews
53% (45 ratings)