Guest User

Untitled

a guest
Jun 18th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. import enchant
  2. import itertools
  3. d = enchant.Dict("en_US")
  4.  
  5. while True:
  6. text = input('Enter text to be anagrammed: ')
  7.  
  8. perms = set([''.join(p) for p in itertools.permutations(text.replace(' ', ''))])
  9.  
  10. anagrams = []
  11. for i in perms:
  12. if d.check(i) == True:
  13. anagrams.append(i)
  14.  
  15. print(anagrams)
Add Comment
Please, Sign In to add comment