Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Print out all of the individual, unique words contained in the file, in alphabetical order. I'm doing this in python, I've got most of the
Print out all of the individual, unique words contained in the file, in alphabetical order. I'm doing this in python, I've got most of the code but when I run the program if it sees 2 of the same words it counts them. but I don't want it to because then it wouldn't be unique.
infile = input ("Enter file name: ") words = 0 th open (infile, 'T') as t: 11 list() for line in t: line- line replace (",, W) line line.replace (N.) line = line . replace (..", "") lin = line. strap().split () for t in lin: 11.append (t) word n 11: words+= 1 1sort() print (11, There ts: 1, words, "total un lae words infile = input ("Enter file name: ") words = 0 th open (infile, 'T') as t: 11 list() for line in t: line- line replace (",, W) line line.replace (N.) line = line . replace (..", "") lin = line. strap().split () for t in lin: 11.append (t) word n 11: words+= 1 1sort() print (11, There ts: 1, words, "total un lae words
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started