Thursday, April 28, 2011

Python Challenge Level 02

In the level, you would see a hint, "recognize the characters. maybe they are in the book, but MAYBE they are in the page source." By the hint, I knew that I must check the source codes in the page.

The page source said "find rare characters in the mess below:", followed by a large chunk of text. I copied the text into "2.in" on my computer and ran to following codes to find the rarest characters, which were "aeilquty\n". By permutation, I knew the next level was "equality.html".

text = open('2.in').read()
print ''.join(sorted(set(text),lambda x,y: text.count(x) - text.count(y) ))

No comments:

Post a Comment