Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We have provided a Python file Proverbs _ Flashcards _ 2 3 J . py that you should work from when answering this question this

We have provided a Python file Proverbs_Flashcards_23J.py that you should work from when answering this question this is on the Assessment page of the module website. Please note that we have not updated the comments to reflect the code changes one of your tasks will be to do that.
If you read this program, you will find it is essentially the same as Flashcards_First_Complete_Version.py, except that we have replaced the glossary dictionary and all references to it with a dictionary proverbs_dictionary. The keys in this dictionary are proverbial phrases missing the last word, and the values are the missing final words. If you run it at this point, it behaves just like Flashcards_First_Complete_Version.py except it shows incomplete phrases and missing words, rather than glossary terms and their definitions.
i.Write an algorithm for the following section from Box 1, reproduced here for convenience.
The program should allow the user to ask for an entry from a list of proverbial phrases, each of which is missing the last word (always represented by six hyphens). In response, the program should randomly pick an entry from the list. It should then display the incomplete phrase and invite the user to supply the missing word. When user enters a word, the program should check to see if it is correct. If so, the program should congratulate the user. Otherwise, the program should tell the user they were wrong and display the phrase with the missing word filled in.
Your algorithm should provide a similar level of detail to the show flashcard algorithm in Section 2.5.2 of Block 3 Part 2. Your algorithm should resemble the one shown there, except that the user will need to do more than just press return, and the program will have to evaluate the user response and act accordingly.
ii.Explain briefly how you will test the program. Only a short answer is required, and you do not need to give examples, only describe in a few lines what approach you will follow.
iii.Now you will implement your algorithm as Python code, modifying the provided Python program Proverbs_Flashcards_23J.py.
Complete a new version of show_flashcard() by modifying the code so it implements the algorithm you produced in part (a)(i).
Also modify the docstring for the show_flashcard() function and the docstring for the program as a whole, to take account of the changed functionality and behaviour.
Important: Do not make changes to any other parts of the program.
When you have made the required changes, run the program to test it.
Copy your modified program, as text, into your solution document.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions