Skip to content

Instantly share code, notes, and snippets.

@stevekrenzel
Created February 12, 2012 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevekrenzel/1806430 to your computer and use it in GitHub Desktop.
Save stevekrenzel/1806430 to your computer and use it in GitHub Desktop.
Scrambled words solution
#!/usr/bin/env python
from urllib import urlopen
word_list = urlopen('http://pastebin.com/raw.php?i=jSD873gL').read().split()
scrambled_words = ['mkeart', 'sleewa', 'edcudls', 'iragoge', 'usrlsle',
'nalraoci', 'nsdeuto', 'amrhat', 'inknsy', 'iferkna']
for scrambled in sorted(scrambled_words, key=len):
matches = [word for word in word_list if sorted(scrambled) == sorted(word)]
print scrambled + ": " + ' '.join(matches)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment