Slashdot Mirror


PythonChallenge - an Amusing Way to Explore Python

thesamet writes "The Python Challenge is a set of riddles that require a little bit of Python programming to be solved. The purpose of the riddles is to provide an entertaining way to explore the Python programming language. The challenge was started late in April this year and it is starting to gain popularity in the Python community. What people love most about the challenge is that it makes them poke in Python's module library and discover new things. It truly demonstrates the great power of Python's included 'batteries.' The riddles are designed to be solvable by Python beginners, but yet are challenging even to experienced Python programmers. The first few riddles are very easy, but it gradually becomes more and more challenging. Many people reported that playing the challenge is highly addictive and it is great fun. The site also features discussion forums where users can ask for hints. Additionally, after solving a riddle, its solution is available in a wiki form."

43 comments

  1. Uh oh... by Anonymous Coward · · Score: 0

    Let's watch that counter fly...

  2. not to nitpick here by Naikrovek · · Score: 4, Funny

    but where's the perl version?

    python is ugly and unreadable.

    1. Re:not to nitpick here by Anonymous Coward · · Score: 0

      First Post !!!!11!

    2. Re:not to nitpick here by Anonymous Coward · · Score: 2, Interesting

      I don't know of anything exactly the same, but the Perl culture is full of fun playthings centered on enjoyment of the language for its own sake. One might even argue that much of the development process of Perl 6 itself has this flavor, with Apocalypses and Exegeses that partially are language specifications, but are really more like essays or articles on programming in Perl and how positive it is. That's to say the least of things like the Perl advent calendar, which are much more like the Python challenge.

      Having said that, I think that there probably should be something more for Perl along the lines of a programming challenge in particular, rather than just fun dialogue.

      The one language that I think is in dire need of this sort of stuff, more than Perl or Python, is Ocaml. It's a powerful language with a dedicated fan base, who enjoy programming in it for its own sake, but lacks the sort of cohesive community that other languages have. A programming challenge sort of thing might appeal to those who might be interested in OCaml.

    3. Re:not to nitpick here by stjobe · · Score: 3, Informative

      Here.

      --
      "Total destruction the only solution" - Bob Marley
    4. Re:not to nitpick here by Anonymous Coward · · Score: 1, Informative

      python is ugly and unreadable.

      You must be a very good computer scientist to reject a language because it has a style guide that's enforced - and to have a strong opinion about a language that you obviously don't know. Wow.

      My recommendation to you is to spend 10 minutes reading this tutorial and playing with the language, then to spend couple of minutes browsing through the documentation.

      Then when you have a quick scripting project you decide to undertake - build a solution in Perl, but take a couple of extra minutes to also try it in Python. You'll probably love it - once trying Python I never looked back to Perl.

    5. Re:not to nitpick here by JudasBlue · · Score: 1

      Repeat after me, do not feed the troll, do not feed the troll...

      --

      7. What we cannot speak about we must pass over in silence.

    6. Re:not to nitpick here by Anonymous Coward · · Score: 0
      You must be a very good computer scientist to reject a language because it has a style guide that's enforced - and to have a strong opinion about a language that you obviously don't know. Wow.
      I hate to break it to you, but 'computer science' is not science, and his reason for rejecting the language is about as grounded in science as any other. Besides, he was clearly joking.
    7. Re:not to nitpick here by Anonymous Coward · · Score: 0

      I hate to break it to you, but 'computer science' is not science

      Er, on what grounds do you make that claim? Computer science is a branch of applied mathematics. What scientific criterion does it not meet that is met by, say, biology?

    8. Re:not to nitpick here by Anonymous Coward · · Score: 0
      Math is not Science. Math is a tool of science, but that is not the same as equivalency.

      Don't get me wrong, I am not suggesting CS is useless. I just felt that his comment was retarded.

    9. Re:not to nitpick here by Anonymous Coward · · Score: 0

      Its a joke not a troll, mod it funny!

      If you have some mod points, mod it underrated to kill the negative karma from the troll mod.

    10. Re:not to nitpick here by Anonymous Coward · · Score: 0

      Mathematics is not a science, ironically enough.

    11. Re:not to nitpick here by Anonymous Coward · · Score: 0
      coming from someone asking for a perl version, the statement
      python is ugly and unreadable

      can mean only one thing - in the light of your comment, that is.
      YOU missed the JOKE
    12. Re:not to nitpick here by Anonymous Coward · · Score: 0

      Perl Quiz of the Week

      (Last update Thu Oct 21 08:10:43 2004) ... seems to be a cobwebsite.

  3. yeah, that... by InsaneCreator · · Score: 4, Funny

    Many people reported that playing the challenge is highly addictive and it is great fun.

    It's even more addictive and fun to express solutions as perl one-liners. :)

    1. Re:yeah, that... by fredrikj · · Score: 1

      Any program can be written in a single line in Python as well.

    2. Re:yeah, that... by Anonymous Coward · · Score: 1, Funny

      Yeah, like:

      exec("perl -e '...'")

    3. Re:yeah, that... by fredrikj · · Score: 1

      Much simpler than that: in Python, "exec" takes a string of Python code which may be a complete program.

      That cheat isn't necessary to write one-liners though.

  4. yes, a lovely puzzle. by wizbit · · Score: 0, Troll

    i'd have more respect for the authors had they not shamelessly ripped off the notpron site and declined to credit anyone with the idea.

    yay python!

    1. Re:yes, a lovely puzzle. by Surye · · Score: 1

      If they ripped off content, I'd be upset. But they didn't, so get over it.

    2. Re:yes, a lovely puzzle. by pjl5602 · · Score: 3, Informative

      From the FAQ:

      <snip>
      Where did you get the idea from?
      I was inspired while I was playing notpron. It just occured to me that the same style of riddles can serve as a way to discover Python.
      <snip>

  5. Also check out RubyQuiz by Colonel+Panic · · Score: 4, Informative

    If you're interested in exploring Ruby in a similar way check out RubyQuiz.

    1. Re:Also check out RubyQuiz by Da+VinMan · · Score: 1

      I was wondering about that. Thank you!

      FWIW - I've been struggling with choosing between Python and Ruby for some personal projects. These two sites should help tremendously since, if I go by which one I enjoy reading more, then I have a winner.

      --
      Please mod this post only if you think others should/n't read this. I have enough ego^H^H^Hkarma. Thanks!
    2. Re:Also check out RubyQuiz by swimin · · Score: 1

      Good luck hating reading ruby. Ruby is great to read, and has some very interesting things, but In some places, its lacking.

    3. Re:Also check out RubyQuiz by Da+VinMan · · Score: 1

      Care to elaborate on what you feel it's lacking?

      --
      Please mod this post only if you think others should/n't read this. I have enough ego^H^H^Hkarma. Thanks!
    4. Re:Also check out RubyQuiz by Taladar · · Score: 1

      Number of (non-japanese) libraries available.

    5. Re:Also check out RubyQuiz by swimin · · Score: 1

      Ummmm, english documentation?

      A good forum would be nice too.

  6. Okay, I just don't get numer 3. by Anonymous Coward · · Score: 0

    arcade@linux:~> cat equality.html | perl -e '
    while () { if ($_ =~ m/[::lower::][[:upper:]]{3}[[:lower:]][[:upper:]]{ 3}[[:lower:]]/) { print ; } }
    '

    with a diamon inside the while() thing, but that get's filtered out - and I don't know html enough. It gives the following output:

    cZoExqHxUzeOEKiVEYjRkeiQyLXLRUAiPPviwCyNaOzenFIk ND xKMcKanMNLNVrYociOBCVoqQPgsrpT

    Okay, now, OEKiVEY seems to be the string they're looking for, but neither 'i', 'OEKiVEY', 'oekivey', 'oekvey' or anything else I can think of let's me go anywhere.

    I'm stumped.

    1. Re:Okay, I just don't get numer 3. by Anonymous Coward · · Score: 0

      Your regex is messed up... try [[:lower:]] instead of [::lower::]. There are multiple matches.

    2. Re:Okay, I just don't get numer 3. by Anonymous Coward · · Score: 0

      If you're not going to solve it with Python, you could've just used grep. Or sed will even solve it completely, rather than making you hunt for where the match is in the line. Nice Gratuitous Use of cat there too.

    3. Re:Okay, I just don't get numer 3. by Anonymous Coward · · Score: 0
      I don't have python either, so I solved this problem with a char buffer in C and some bit twiddling. I debated whether or not to count newlines as part of the input stream, but I got the right answer treating this as a line-by-line problem. The first time I solved it, I didn't correctly interpret the "you got it right" response given by the server, so I wasted a bit of time looking for an answer in 2 dimensions. :-(
      @...@...@
      .U..U..U.
      ..U.U.U..
      ...UUU...
      @UUUlU UU@ where @ is either l or missing (e.g. ^ or $)
      ...UUU...
      ..U.U.U..
      .U..U..U.
      @...@...@
    4. Re:Okay, I just don't get numer 3. by Anonymous Coward · · Score: 0

      Doh! Thanks! That got me further.

    5. Re:Okay, I just don't get numer 3. by mmaddox · · Score: 1

      I did that, too. However, if you optimize your search using Regex searching for [A-Z]{3}([a-z])[A-Z]{3} pattern first (before diving into the other dimensions, printing a status message shows the answer pretty clearly. Still, I should've tried the obvious first. That's probably a learning experience.

      --

      What'dya mean there's no BLINK tag!?

  7. It's the same puzzle... by mystran · · Score: 1
    ...but modified rules:

    Each riddle must be solved with oneliner in Perl.

    And credit where credit is due. I admit seeing this suggestion (IIRC) on Lambda the Ultimate.

    --
    Software should be free as in speech, but if we also get some free beer, all the better.
  8. Python? by ralejs · · Score: 2, Interesting
    .. a set of riddles that require a little bit of Python programming to be solved.

    Cross out the "Python" above. There is no need to use Python to solve these puzzles. I use Haskell. Some other language might work for someone else. There is nothing Python specific about the challenges. But they are indeed quite amusing.

    1. Re:Python? by Saedrael · · Score: 1

      "There is no need to use Python to solve these puzzles" Really? Is cvpxyr (rot13ed) available in other languages?

    2. Re:Python? by ralejs · · Score: 2, Insightful

      It is really not that difficult to write that function yourself.

    3. Re:Python? by ggvaidya · · Score: 1

      Be warned: while this is true for most of them, atleast one level requires Pickle.

  9. Re:4) follow the chain by fizbin · · Score: 1

    I'm curious - what about writing that sort of program bothers you? I wrote such a thing in just a few lines of shell code, so I don't think it's the drudgery...

  10. Re:4) follow the chain by mmaddox · · Score: 2

    Translation:

    "I'm too pissy to do puzzles. Fuck you all for thinking Python puzzles might be fun."

    --

    What'dya mean there's no BLINK tag!?