Question: Write a program to autocorrect a line of text Prompt the user for a file with misspelled words and their corrected versions. For example, words

Write a program to autocorrect a line of text
Prompt the user for a file with misspelled words and their corrected versions. For example, words1.txt is
teh=the
yuo=you
wnat=want
If the input line contains teh', change the word to the
If the input line contains yuo', change the word to you
If the input line contains wnat', change the word to want
Use a dictionary to store the misspelled words as the keys and the corrected words as the corresponding values
Prompt the user for the line to correct
Print the corrected line
NOTE: The corrected line in the sample runs has a single space at the end of the line. There are many ways to build and print the corrected line. If your program uses a method that does not result with a single trailing space, then simply print one space on the same line as your corrected line.
Sample Run #1(bold, underlined text is what the user types):
File? words1.txt
Line? teh wrod yuo wnat is hppay
the wrod you want is hppay
Note: This is an introdcutory level python class, this problem covers dictionaries. Please no classes and we are required to atleast have a main function, more are optional. There is an example of what should be outputted when the program is intercated with.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!