Implementing Real-World English Dictionary in Python


# pip install Py-Dictionary

from pydictionary import Dictionary

print("Welocme to the English Dictionary!")
print("""What you want to know?
      A- Meanings
      B- Synonyms
      C- Antonyms""")

option = input("Plz enter your option: ").lower()

if option == "a":
      
      word = input("Enter the word to know its meaning(s): ")
      dict = Dictionary(word, 2)
      dict.print_meanings("yellow") # yellow is for color of the printed text
            
elif option == "b":
      word = input("Enter the word to know its synonym(s): ")
      dict = Dictionary(word, 3)
      dict.print_synonyms("blue")
           
elif option == "c":
      word = input("Enter the word to know its antonym(s): ")
      dict = Dictionary(word, 4)
      dict.print_antonyms("green")
            
else:
      print("Invalid input")
   

    

Comments

Popular posts from this blog

Quotation marks to wrap an element in HTML

The Basic Structure of a Full-Stack Web App

Unlocking Web Design: A Guide to Mastering CSS Layout Modes