consider a program that reads data from a text file called: "klingon-english.txt" (shown below). How would one construct such a program with the following conditions: 1. Ask the user to choose a Klingon consonant they want to practice with. Ask again if the user’s answer is not a valid Klingon consonant, until the user enters a valid consonant. 2. Find a Klingon word that starts with the chosen consonant (the text file contains only one word that starts with any given consonant, so you don’t need to use the random library) 3. Ask the user to translate the chosen word into Klingon 4. Print "Correct" if the user’s answer is correct 5. Print "Sorry, you’re wrong!" if the user’s answer is wrong 6. Print The correct answer is ... if all three user’s answers are wrong You will also factor in this version: 7. If the answer is incorrect, show the first hint: the first and last characters of the correct Klingon word. When showing a hint, replace all other characters with a star (*) 8. If the answer is still incorrect, show the second hint: the first and the last characters plus an extra random character of the correct Klingon word. You must read data from the provided text file, that is absolutely essential in this lab assignment. You can not hardcode the words: Here is the text file: batlh|honor cha'pujqut|dilithium crystal De'wI'|computer ghIgh|necklace HablI'|data transceiving device jabbI'ID|data transmission laSvargh|factory mIgh|be evil noch|sensor pong|name qawHaq|memory banks Qagh|error, mistake rIgh|be lame Sagh|be serious tayqeq|civilization voDleH|emperor wa'leS|tomorrow yuQHom|planetoid 'avwI'|guard The attached pictures are example Demonstrations of how a code like this might work. How would I start to code a program like this and which functions should I use? Thank you very much!
consider a
1. Ask the user to choose a Klingon consonant they want to practice with. Ask again if the user’s answer is not a valid Klingon consonant, until the user enters a valid consonant.
2. Find a Klingon word that starts with the chosen consonant (the text file contains only one word that starts with any given consonant, so you don’t need to use the random library)
3. Ask the user to translate the chosen word into Klingon
4. Print "Correct" if the user’s answer is correct
5. Print "Sorry, you’re wrong!" if the user’s answer is wrong
6. Print The correct answer is ... if all three user’s answers are wrong
You will also factor in this version:
7. If the answer is incorrect, show the first hint: the first and last characters of the correct Klingon word. When showing a hint, replace all other characters with a star (*)
8. If the answer is still incorrect, show the second hint: the first and the last characters plus an extra random character of the correct Klingon word.
You must read data from the provided text file, that is absolutely essential in this lab assignment. You can not hardcode the words:
Here is the text file:
batlh|honor
cha'pujqut|dilithium crystal
De'wI'|computer
ghIgh|necklace
HablI'|data transceiving device
jabbI'ID|data transmission
laSvargh|factory
mIgh|be evil
noch|sensor
pong|name
qawHaq|memory banks
Qagh|error, mistake
rIgh|be lame
Sagh|be serious
tayqeq|civilization
voDleH|emperor
wa'leS|tomorrow
yuQHom|planetoid
'avwI'|guard
The attached pictures are example Demonstrations of how a code like this might work.
How would I start to code a program like this and which functions should I use?
Thank you very much!
Step by step
Solved in 4 steps with 3 images