Home > PythonChallenge.Com > PythonChallenge – Level 2

PythonChallenge – Level 2


Homepage: http://www.pythonchallenge.com/pc/def/ocr.html

How I solve:

– From the hints:

recognize the characters. maybe they are in the book,
but MAYBE they are in the page source.

I open up to view this page source code in HTML; apparently, there’s a block of unreadable text and it’s being said to find some rare readable character.
– Logically, if it’s readable then there should be some character appearing on this crazy text. I use Ctrl+F to find some character, and as always, “aeiouy“. They do appear inside. So I decide to paste this into a file “data.txt” and write a small script to get all alphabet letters from it.

import string
lines = open("data.txt").readlines()
result = [(x) for line in lines for x in line if x.isalpha() == True]
print string.join(result, "");

– Right away, I got result very human-readable: “equality“.
– I put it up on browser, then up to next level.

Cheers,
Pete Houston

Advertisements
Categories: PythonChallenge.Com Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: