Guest User

Untitled

a guest
Jul 15th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. words_set=set([])
  2. for line in open('word.list', 'r'):
  3.     words_set.add(line.strip())
  4.  
  5. import sys
  6. letters = list(sys.argv[1])
  7. n = int(sys.argv[2])
  8.  
  9. import itertools
  10. found=[]
  11. for x in itertools.permutations(letters, n):
  12.     w = ''.join(x)
  13.     if w in words_set and not w in found:
  14.         print 'found', w
  15.         found.append(w)
Add Comment
Please, Sign In to add comment