Answer:
Check the explanation
Step-by-step explanation:
class LanguageHelper:
language=set()
#Constructor
def __init__(self, words):
for w in words:
self.language.add(w)
def __contains__(self,query):
return query in self.language
def getSuggestionns(self,query):
matches = []
for string in self.language:
if string.lower().startswith(query) or query.lower().startswith(string) or query.lower() in string.lower():
matches.append(string)
return matches
lh = LanguageHelper(["how","Hi","What","Hisa"])
print('how' in lh)
print(lh.getSuggestionns('hi'))
===========================================
OUTPUT:-
==================
True
['Hisa', 'Hi']
====