Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Autocomplete:
- def __init__(self, *arg):
- self.dict = {}
- self.arg = arg
- for i in arg:
- self.add(i)
- def add(self, word):
- if word[0] in self.dict:
- self.dict[word[0]].append(word)
- return self
- else:
- self.dict[word[0]] = [word]
- return self
- def extend(self,lijst):
- for i in lijst:
- self.add(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement