-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathThesaurus App.py
More file actions
40 lines (28 loc) · 1.24 KB
/
Thesaurus App.py
File metadata and controls
40 lines (28 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#Theaurus App
#this program will give you sysnoyms of word
import random
print("Welcome to Thesaurus app.\n")
print("Choose a word from the thesaurus and I will give you a sysnonym.")
print('Thesaurus is a reference book in which words with similiar meanings are grouped together.\n')
word = {'happy': ['pleased', 'glad', 'peaceful', 'sunny', 'delighted'],
'sad' : ['dark', 'bad', 'unhappy', 'tragic', 'tragic'],
'life': ['existence', 'survival', 'season', 'living', 'being'],
'education': ['discipline', 'information', 'improvement', 'study', 'refinement']
}
print('Here are the words in the thesaurus:')
for key in word.keys():
print('\t-',key)
w = input("What word you would like to synonym for:").lower()
if w in word.keys():
r = random.randint(0,4)
print("A synonym for ", w, " is ", word[w][r] + ".")
else:
print("I'm sorry!, That word not in thesaurus currently.")
show_all = input("\nWould you like to see whole thesurus(yes/no) : ").lower()
if show_all.startswith('y'):
for key, values in word.items():
print("\n", key.title() + " synonyms are: ")
for value in values:
print("\t", value)
else:
print("Hope you enjoy the program")