Labels

Recent Posts

Thursday, October 31, 2013

Great Python Challenge

Just like "The Great Giraffe Challenge", let us take  the Great Python Challenge.

The answer will be a piece of very short, one-liner like Python code. So it won't take too much of your time.

As usual, if you failed, changed your profile to a python related picture until, say, you find out the answer.

Are you ready?








Please write a simple http server in less than 40 characters of Python code.


A server can only send "Error Response" or worse does not count. A server can only serve one request does not count. It has to be something like a SimpleHTTPServer at least.
You can use either standard CPython 2.x or 3.x. Only the standard library are allowed.
The solution should not rely on command line argument,  environment variable, or similar technique to by pass the limit.
All you can use is CPython and it's standard library. 






So, got your answer yet?
.
.
.
.
.
.
If you think you know Python, then chances are you can do that.
If your code contains exactly 40 characters, please try harder. 


But there are more,

Same as above, but please write it in less than 35 characters.

A bit more fun and challenging, right?
Can you do that?
.
.
.
.
.
.
But we are not done yet, now
Same as above, but please write it in less than  30 characters.

I didn't find the last answer by myself without the help from friends, so I changed my facebook profile to the picture on the top of this post.

.
.
.
.
.
.
If you can write a python web server in 29, 28 or even 25 characters, then very well done, good job.
We have one more task for you,
Same as above, but please write it in less than  25 characters.

No comments:

Post a Comment