Python Challenge level 6: “now there are pairs”

Level 6 deals again with linked lists.

Hint 1: Image is a zipper and there is a comment in the page (<!– <– zip –>). Once we open channel.zip, there are some more hints: “welcome to my zipped list“.
Hint 2: start from 90052
Hint 3: answer is inside the zip

import zipfile,re
idx="90052"
file = zipfile.ZipFile("channel.zip", "r")
history = []
while True:
    history.append(idx)
    data = file.read(idx+".txt")
    print "File",idx+":\t"+ data
    idx="".join(re.findall('[0-9.]',data))
    if len(idx)==1:
        break
#Collect the comments
print ''.join([file.getinfo(i+'.txt').comment for i in history])
File 90052:     Next nothing is 94191
File 94191:     Next nothing is 85503
[...]
File 67824:     Next nothing is 46145
File 46145:     Collect the comments.
****************************************************************
****************************************************************
**                                                            **
**   OO    OO    XX      YYYY    GG    GG  EEEEEE NN      NN  **
**   OO    OO  XXXXXX   YYYYYY   GG   GG   EEEEEE  NN    NN   **
**   OO    OO XXX  XXX YYY   YY  GG GG     EE       NN  NN    **
**   OOOOOOOO XX    XX YY        GGG       EEEEE     NNNN     **
**   OOOOOOOO XX    XX YY        GGG       EEEEE      NN      **
**   OO    OO XXX  XXX YYY   YY  GG GG     EE         NN      **
**   OO    OO  XXXXXX   YYYYYY   GG   GG   EEEEEE     NN      **
**   OO    OO    XX      YYYY    GG    GG  EEEEEE     NN      **
**                                                            **
****************************************************************
 **************************************************************

… and in hockey.html

it’s in the air. look at the letters.

Hm… the letters in “hockey” are made out of “o, x, y, g, e, n”. Level 7, here we go!

UPDATE: A ‘\’ was missing in the code. Thanks to PSquid for reporting.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

13 Comments »

 
  • azurepalm says:

    Ugh, I still don’t understand how you get from “Collect the comments” to hockey.html

  • Those would be the comments for every single file zipped in the compressed archive. Try “unzip -l channel.zip | less” if it’s still unclear. :)
    I don’t do Windows, so I’m not really sure how you could view the comments from there.

  • azurepalm says:

    ah ok. i never thought that these files have a comment field on them. thanks.

  • zero says:

    And what about the pairs? There were no pairs in the entire riddle. The 94191.txt is not part of the series. Why is that? It misleads me completely. I tried to combine the 2 series with the zip function and do various stuffs with the pairs, but it leads me nowhere.
    (Btw, I had no idea about the comment field associated to each zip entry.)

  • EoghanM says:

    Ugh
    ‘zip’ was misleading as it is a built in Python function, the hint should have read ‘.zip’
    The comment information was lost when I automatically extracted the zip file – rendering hint2 completely misleading -> the answer isn’t inside the zip, it’s in the zip metadata.
    Ugh

  • PJD says:

    I get:


    Traceback (most recent call last):
    File "./channel.py", line 13, in
    content = file.read(name + ".txt")
    File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/zipfile.py", line 836, in read
    return self.open(name, "r", pwd).read()
    File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/zipfile.py", line 859, in open
    zinfo = self.getinfo(name)
    File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/zipfile.py", line 826, in getinfo
    'There is no item named %r in the archive' % name)
    KeyError: "There is no item named '90052.txt' in the archive"

    when i run the script.
    Could it have something to do with the version of python I’m using?

  • Taher says:

    Nope. 2.6 works just fine. But your zipfile is broken.


    taher@borg:~/src/python_challenge$ unzip -l channel.zip

    This should report 910 files in the compressed file.

  • kalt says:

    where’s the word “oxygen” coming from?

  • @kalt: look at the characters used to draw HOCKEY. O for H, X for O, etc.

  • Psychedelic Squid says:

    print "File",idx+":t"+ data
    should be
    print "File",idx+":\t"+ data

  • `.’ I am very thankful to this topic because it really gives useful information *`:

  • Sebastian says:

    It was fun to read this article:) Thanks, very interesting.

  • It has always been my belief that great writing like this takes research and talent. It is very apparent you’ve got done your homework. Great job!

 

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>