[Tutor] voluntary work :p:

Walter Prins wprins at gmail.com
Tue Apr 26 14:54:04 CEST 2011


On 26 April 2011 04:59, Wolf Halton <wolf.halton at gmail.com> wrote:

> I didn't get anything out of pythonchallenge.  All seems static.  Do you
> need flash or something to make the magic happen?
>
>
To add to what the others have said and explain the "flow" a bit more:  Each
challenge is a puzzle, with hints present in various places, either in the
displayed image and/or text, sometimes in the page source, sometimes hidden
inside an image or a file that you must download etc, and so on.

The general goal for solving each puzzle is to find the next puzzle's
solution URL and the next puzzle URL by modifying the page URL of the
current puzzle based on your detective work on the current puzzle.  In
several instances (especially in the beginning) it's actually possible to
solve a puzzle without using Python, but obviously the idea is really to
solve or perform whatever calculations are required using Python, and
thereby in the process learn something about Python as you go.

Now, the very first puzzle presents you with a number, 2^38, and a hint "Try
to change the URL address".  Now, with a bit of research you'll find that
Python's way to expressing exponentiation is with the ** operator.  Thus,
one might as a first try, attempt changing the URL to simply that, e.g.:
http://www.pythonchallenge.com/pc/def/2**38.html

Attempting that, takes you to a page that says: "give the answer, not the
question." ... Hmmm....

OK.  So that should lead you to the conclusion that you need to actually
calculate the answer to 2^38, and then try that in the URL instead... Now
after a bit of reading you should find out about the interactive aspects of
the Python interpreter and that you can use it as a calculator, and that you
can calculate the answer by simply typing 2**38 into the Python
interpreter.  Doing all that then teaches you something about the Python
interpreter, and the fact that Python copes easily with very large numbers,
which in many other languages would be problematic.

And so it goes.  You'll quickly get to places where you e.g. have to
interact with the website quite a number of times to figure out what the
next puzzle URL should be, and thereby be pushed to learn about urllib and
Python's wonderful web modules in order to automate the interaction, places
where you have to do some relatively involved (if you tried to do the same
in other languages) text processing in order to get the answer and so on.

Every puzzle pushes you to learn about a specific aspect of Python, and
impresses upon you (especially if you have any prior programming experience)
just how elegant and powerful Python really is.  As an aside, The Python
Challenge was one of the things that originally impressed on me just how
good and useful a language Python really is, and how wide the variety of
contexts are where it can be usefully applied.

Best regards,

Walter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110426/c067535a/attachment-0001.html>


More information about the Tutor mailing list