r/learnpython • u/Puzzleheaded-Pay641 • Aug 27 '24
I need a question dumbing down because I'm just not getting it
Hello all,
I'm currently doing my Uni assignment so I'm not looking for ways to cheat or anything, I just need this question dumbing down in a way that makes sense so I can actually learn and work through it.
I have ADHD and I'm currently unmedicated so I'm struggling to process information which is why I'm asking, I really don't want to cheat and come here to gain the answers, I just need a really basic step by step of what I should be doing and looking for instead of this absolute BLOCK of text.
Any support and I will be extremely grateful, I'm getting so frustrated and I don't understand why I for some reason just can't get this one.
Thank you
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
A. We have provided a Python file Spellings_Flashcards_24D.py that you should work from when answering this question. Please note that we have not updated the comments to reflect the code changes and 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 words. The keys in this dictionary are correctly spelt words, and the corresponding values are common misspellings of those words.
If you run it at this point, it behaves much like Flashcards_First_Complete_Version.py except it shows correctly spelt words and the corresponding misspellings, rather than glossary terms and their definitions.
i.Write an algorithm for the following section from Box 1, reproduced here for convenience.*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.*You will need a way to decide whether the correct or incorrect spelling is displayed first. The method we suggest is to simulate the flipping of a coin, as discussed in Subsection 2.2.2. of Block 3 Part 2. If the simulated coin flip comes up heads, display the correct spelling first and the incorrect spelling second; otherwise, display the incorrect spelling first and the correct spelling second.Your algorithm should provide a similar level of detail to the show flashcard algorithm in Subsection 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.Say 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 Spellings_Flashcards_24D.py.Complete a new version of show_flashcard() by modifying the code so it implements the algorithm you produced in Part 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.Tip: if you want to print several items on the same line, Python lets you just make them arguments to a single print statement. For example, if variables x and y hold the values 1 and 2 respectively, executing the statementprint(x, ‘and’, y, ‘makes’, x + y)will result in1 and 2 makes 3Important note*: Do not make change 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.Please also note
The changes you make to the function show_flashcard() must be consistent with the algorithm you gave in Part i.
The chief purpose of this question is to let you show mastery of the TM112 problem solving approach and of the Python features that are introduced in the module and in the tip above.If you consider there is a compelling reason why you need features not introduced in TM112 you must explain your reasons; otherwise, marks may be lost.
If you are unable to get the program working correctly, you should still copy your code into your Solution Document with a brief explanation of how the results are different from what you intended.
iv.Write a short reflection looking back on your personal experience of solving the modified flashcard problem, following the framework given in Box 2 above and drawing on the notes you made as you went along.Include the final version of your completed Spellings_Flashcards_24D.py file in your TMA submission folder.