Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import itertools
  2. import enchant
  3.  
  4. word = input("Please enter the letters or words to scramble: ")
  5. perm_words = itertools.chain.from_iterable(itertools.permutations(word, i) for i in range(3,len(word)))
  6. list_possible = []
  7. list_words_print = []
  8.  
  9. for item in perm_words:
  10. list_possible.append("".join(item).lower())
  11.  
  12. dictionary = enchant.Dict("en_UK")
  13. for word in list_possible:
  14. if dictionary.check(word):
  15. if word not in list_words_print: list_words_print.append(word)
  16.  
  17. print (list(item for item in list_words_print))
  18. exit_key = input("Press any key to exit")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement