Challenge 4

Following the idea yesterday, here is my first script:

import urllib;
import string;
import re;

def followNothing(url):
page=urllib.urlopen(url)
pagecontent = page.read()
print pagecontent
result =re.search(”[0-9]{5}”, pagecontent)
if result:
num = pagecontent[result.start():result.end()]
nexturl = “http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=” + num
followNothing(nexturl)
else:
print “fix the script!”
and I got:

In [12]: followNothing("http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=12345")
and the next nothing is 92512
and the next nothing is 64505
<font color=red>Your hands are getting tired </font>and the next nothing is 50010
and the next nothing is 29193
and the next nothing is 89924
and the next nothing is 65471
and the next nothing is 69977
and the next nothing is 6306
fix the script!

OK, it’s not necessary to be 5 numbers.

import urllib;
import string;
import re;

def followNothing(url):
page=urllib.urlopen(url)
pagecontent = page.read()
print pagecontent
result =re.search(”[0-9]+”, pagecontent)
if result:
num = pagecontent[result.start():result.end()]
nexturl = “http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=” + num
followNothing(nexturl)
else:
print “fix the script!”
and…

….
and the next nothing is 37852
and the next nothing is 61066
There maybe misleading numbers in the
text. One example is 61067. Look only for the next nothing and the next nothing is 53522
You’ve been misleaded to here. Go to previous
one and check.
fix the script!

OK,

import urllib;
import string;
import re;

def followNothing(url):
page=urllib.urlopen(url)
pagecontent = page.read()
print pagecontent
result =re.search(”next nothing is [0-9]+”, pagecontent)
if result:
num = pagecontent[result.start()+16:result.end()]
nexturl = “http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=” + num
followNothing(nexturl)
else:
print “fix the script!”
And after a long time…

and the next nothing is 92118
Yes. Divide by two and keep going.
fix the script!

I visited http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=46059 and found it’s still “and the next nothing is 33110″

Don’t know what the pattern is so just do it manually this time: call followNothing(”http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=33110″)

and the next nothing is 27719
and the next nothing is 65667
peak.html
fix the script!

OK, challenge 5 is at http://www.pythonchallenge.com/pc/def/peak.html

The hint is “pronounce it”, the title is “peak hell”. Vies the page source and there is another hint: “peak hell sounds familiar ? ”

Well I’m not a native speaker so I first look throu the module names. And I found pickle :) visit http://www.pythonchallenge.com/pc/def/pickle.html and it told me “yes! pickle!”. No title, no more hints, no more source. What’s going on?

So I took a look at the source of http://www.pythonchallenge.com/pc/def/peak.html again and found a wired line:

<peakhell src="banner.p"/>

Give http://www.pythonchallenge.com/pc/def/banner.p a vist and got a mess. I think I’ll need to unpickling this mess tomorrow.

Tags: , ,

Comments 1

  1. seb wrote:

    thks for the tip banner.p (i missed it)

    Posted 10 Oct 2011 at 6:24 pm

Post a Comment

You could use <code type="name"> to get your code colorized

Your email is never published nor shared. Required fields are marked *

Close
E-mail It