Created
February 12, 2012 04:51
-
-
Save stevekrenzel/1806430 to your computer and use it in GitHub Desktop.
Scrambled words solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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