As the title suggests, the code provides the user with the meaning of a random word and the user must guess the word or its synonym. The code has been written in Python language.
Synonyms are any two or more words that have identical meanings. Example:'child' and 'kid' has the same meaning, 'Any human who has not crossed the age of puberty'.
To write the code to get a random word from the English dictionary and display its meaning, the Python Random module is used.
Random Module is a module that is used to execute any random actions like printing random a value for a list or string, the generation of random numbers, etc.
Wordnet is a module consisting of a large corpus of English words. This is used to get the synonym sets for the random English word to be guessed.
The program code contains three functions:
1. My_ramdom_word(size):
This function returns a random word containing a certain number of letters given by the user which is passed to the function as a parameter called 'size'.
2. finding_meanings_and_synonyms(word):
For any word, this function returns its meaning and its synonym as a dictionary key and value pair.
3. start_guessing():
The main function which puts everything together providing an interface.
The working of the program can be seen in the following:
Submitted by Tasneem Fatima (tasneem)
Download packets of source code on Coders Packet
Comments