Question: Your program will take a file name from user, access the file and find out all the words in the file and list them in
Your program will take a file name from user, access the file and find out all the words in the file and list them in alphabetical order. Make sure every word is listed only once. Also state how many words are found in the file as sample output shows.
Also, ask user if user wants to repeat and depends on the answer, your program needs to terminate or repeat.
If user enters wrong information wrong name of the file or nonexisting file name your program needs to display message and ask for correct input. Your program should not generate traceback message with any input.
OUTPUT:
Enter file name: chdatatxt
a 'add', an 'and', 'applications', 'assistant', 'capable', 'different', 'digital', do 'end', 'hardware', 'helpful', 'helping', is 'many', of 'operating', 'personal', 'programmers', 'quite', 'set', 'system', 'that', 'the', 'things.toupuswe 'with'
File chdatatxt has different words
Do you want to try another file? y or ny
Enter file name: aaaaa
file not found, please enter correct file name.
Enter file name: Chdatatxt
amounts 'and', 'are', be 'behalf', 'best', 'boring', 'can', 'computer', 'computers', 'could', do 'explain', 'fast', 'find', 'have', 'helpful', 'humans', if 'interestingly,it 'kinds', 'knew', 'language', 'like', 'memory', 'mind', 'next', 'numbing.of 'often', on 'only', 'our', 'repetitive. 'speak', 'tasks', 'tell', 'that', 'the', 'things', 'this', tous 'vast', 'very', we 'were', 'what', 'would'
File Chdatatxt has different words
Do you want to try another file? y or n
Thank you for playing.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
