File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed
Python_Begginer_Projects/Intermediate Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ from PyDictionary import PyDictionary
2
+
3
+ # A simple word dictionary program
4
+
5
+ dictionary = PyDictionary ()
6
+
7
+
8
+
9
+ def Synonym (word ):
10
+ print (dictionary .synonym (word ))
11
+
12
+ def Antonym (word ):
13
+ print (dictionary .antonym (word ))
14
+
15
+ def Quit ():
16
+ print ('Thanks for using this software...😁👌' )
17
+
18
+ def Meaning (word ):
19
+ print (dictionary .meaning (word ))
20
+
21
+
22
+ def Main ():
23
+
24
+ options = (1 , 2 , 3 )
25
+
26
+ print ('A Simple Word Dictionary Program' )
27
+
28
+ while True :
29
+
30
+ print ('Menu \n 1. Get Meanings 2. Get Synonyms 3. Get Antonyms 4. Quit' )
31
+
32
+
33
+ user_choice = None
34
+ try :
35
+ user_choice = int (input ('Enter a choice: ' ))
36
+
37
+
38
+ if user_choice in options :
39
+ word = input ('Enter a word: ' )
40
+ if user_choice == 1 :
41
+ Meaning (word )
42
+ elif user_choice == 2 :
43
+ Synonym (word )
44
+ else :
45
+ Antonym (word )
46
+ elif user_choice == 4 :
47
+ Quit ()
48
+ break
49
+ else :
50
+ print ('Enter a choice(1-4)' )
51
+
52
+ except ValueError :
53
+ print ('Invalid Option!' )
54
+
55
+ print ('' )
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+ Main ()
You can’t perform that action at this time.
0 commit comments