Question
Write a python program called anagram.py that does the following: Reads in words and their meanings from a text file called words.txt.The easiest way to
- Write a python program called anagram.py that does the following:
- Reads in words and their meanings from a text file called "words.txt".The easiest way to store these would be in a dictionary. You may have a dictionary that looks like the one shown below:
{ "fastidious":"fussy", "delighted":"happy; pleased", .....}
Alternatively, you could store the words in a list and their meanings in a separate list (in a corresponding location, of course).
- Your program should pick a word from the dictionary/list, jumble the letters, and ask the user to unscramble it. The user may type in the unscrambled word or may ask for the definition/meaning of the word by entering a question mark. The game continues until the user says "no" to the question: "Do you want to continue?". A sample run is shown below:
Unscramble the letters to form a word.
Type '?' for the meaning of the unscrambled word
atgprveeiro
Enter word [? for meaning of unscrambled word]: ?
The word means: privilege
atgprveeiro
Enter word [? for meaning of unscrambled word]: prerogative
You got it! Do you want to continue [yes or no]: yes
Unscramble the letters to form a word.
Type '?' for the meaning of the unscrambled word
ssiouadtfi
Enter word [? for meaning of unscrambled word]: fastidious
You got it! Do you want to continue [yes or no]: no
words.txt
abhor:hate
bigot:narrow-minded, prejudiced person
counterfeit:fake; false
enfranchise:give voting rights
hamper:hinder; obstruct
kindle:to start a fire
noxious:harmful; poisonous; lethal
placid:calm; peaceful
remuneration:payment for work done
talisman:lucky charm
abrasive:rough; coarse; harsh
bilk:cheat; defraud
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started