-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMy_Dictionary.py
101 lines (58 loc) · 2.39 KB
/
My_Dictionary.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import json
from difflib import get_close_matches
import os,pyfiglet
from colorama import Fore,Style
import random
data = json.load(open("dictionary.json"))
ban = """ (
)\ ) )
(()/( ( ( /(( ) ( (
/(_)))\ ( )\())\ ( ( ( /( )( )\ )
(_))_((_) )\(_))((_) )\ )\ ) )(_)|()\(()/(
| \(_)((_) |_ (_)((_)_(_/(((_)_ ((_))(_))
| |) | / _|| _|| / _ \ ' \)) _` | '_| || |
|___/|_\__| \__||_\___/_||_|\__,_|_| \_, |
|__/ """
all_col= [Style.BRIGHT+Fore.RED,Style.BRIGHT+Fore.CYAN,Style.BRIGHT+Fore.LIGHTCYAN_EX, Style.BRIGHT+Fore.LIGHTBLUE_EX, Style.BRIGHT+Fore.LIGHTCYAN_EX,Style.BRIGHT+Fore.LIGHTMAGENTA_EX,Style.BRIGHT+Fore.LIGHTYELLOW_EX]
ran = random.choice(all_col)
def banner():
os.system("clear")
print(ran,ban)
print(ran + "\n\t\tV_1.0\t\n\n")
print("*" * 63)
print(Style.BRIGHT+Fore.LIGHTCYAN_EX, "\n" ,"- " * 4, " [+] Follow me on Instagram @saadkhan041 ", "- " * 4)
print(Style.BRIGHT+Fore.LIGHTYELLOW_EX, "\n", "- " * 4, " [+] Follow me on Instagram @coding_memz ", "- " * 4)
print(Style.BRIGHT+Fore.LIGHTRED_EX, "\n", "- " * 4, "[+] Github: https://github.com/Saadkhan041/ ", "- " * 3)
print("\n" , "*" * 63)
banner()
def dictionary(word):
if word in data:
return f'"\n"{ran} {data[word]}'
elif word.title() in data:
return f'{ran}{data[word.title()]}'
elif word.upper() in data:
return "\n"+ran + data[word.upper()]
elif len(get_close_matches(word , data.keys())) > 0:
print(f"\n{ran}Did you mean {get_close_matches(word , data.keys())[0]} instead of")
dec = input(ran+("\nType below [y/n]\n~>")).lower()
if dec == "y":
return f"{ran}{data[get_close_matches(word , data.keys())[0]]}"
elif dec == "n":
return "\n{ran}You like rough play! "
else:
return "\nNothing found! "
cont = ""
no = ["n","no"]
while cont not in no:
word = input(ran+"\nEnter word below to find\n~>").lower()
meaning = dictionary(word)
if type(meaning) == list:
for i in meaning:
print(f"{ran}{i}")
else:
print(f"{ran}{meaning}")
cont = input(ran+"\nDo you want to continue [y/n]\n~>").lower()
if cont == "y":
os.system("clear")
banner()
pass