Question: The program has a dictionary, the keys of which are correct spellings, and the corresponding values are common misspellings of those words. For example, one
The program has a dictionary, the keys of which are correct spellings, and the corresponding values are common misspellings of those words. For example, one dictionary entry is:
'accommodate':'accomodate'
The program should allow the user to ask for an entry from the dictionary. In response the program should choose an entry at random, and then display the correct and incorrect spellings in random order. It should then invite the user to input either A or B depending on whether they believe the first or the second spelling is the correct one.
When the user enters a response, the program should check whether the response is right. If so it should congratulate the user; if not, it should inform them that their choice was wrong.
The user should be able to repeatedly ask for an entry and also have the option to quit instead.
A sample session might run like this:
Enter s to show a word and q to quit: s
Which spelling is right? A accommodate B accomodate
Enter A or B: A
Well done!
Enter s to show a word and q to quit: s
Which spelling is right? A aquire B acquire
Enter A or B: B
Well done!
Enter s to show a word and q to quit: s
Which spelling is right? A exhilarating B exilerating
Enter A or B: B
Sorry, the answer is A
Enter s to show a word and q to quit: s
Which spelling is right? A plagarism B plagiarism
Enter A or B: A
Sorry, the answer is B
Enter s to show a word and q to quit: s
Which spelling is right? A exhilarating B exilerating
Enter A or B: A
Well done!
Enter s to show a word and q to quit: q
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
