Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import itertools
- import enchant
- word = input("Please enter the letters or words to scramble: ")
- perm_words = itertools.chain.from_iterable(itertools.permutations(word, i) for i in range(3,len(word)))
- list_possible = []
- list_words_print = []
- for item in perm_words:
- list_possible.append("".join(item).lower())
- dictionary = enchant.Dict("en_UK")
- for word in list_possible:
- if dictionary.check(word):
- if word not in list_words_print: list_words_print.append(word)
- print (list(item for item in list_words_print))
- exit_key = input("Press any key to exit")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement