I want to see if the word existing in the dictionary or not using the PyDictionary library. I have the following code but I can see some errors as “list index out of range” that I cannot understand. I am new to python.
def fst_wrd(exmp):
from PyDictionary import PyDictionary
dictionary=PyDictionary()
try:
var = (dictionary.meaning(exmp))
except:
if var == None:
return(False)
else:
return (True)
for exmp in my_list:
result = fst_wrd(exmp)
if result == True:
print(exmp, "is dict")
else:
print(exmp, "not dict")
Suppose I have a list as mylist=[“on", "carrot", "hello", "tunc"]. The error I am getting is list: index out of range.