Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import enchant
- import itertools
- d = enchant.Dict("en_US")
- while True:
- text = input('Enter text to be anagrammed: ')
- perms = set([''.join(p) for p in itertools.permutations(text.replace(' ', ''))])
- anagrams = []
- for i in perms:
- if d.check(i) == True:
- anagrams.append(i)
- print(anagrams)
Add Comment
Please, Sign In to add comment