Skip to content

Instantly share code, notes, and snippets.

@fforbeck
Created June 1, 2012 16:33
Show Gist options
  • Save fforbeck/2853388 to your computer and use it in GitHub Desktop.
Save fforbeck/2853388 to your computer and use it in GitHub Desktop.
pc04
import urllib2, re, sys
uri = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing='
nothing = '12345'
def get_next(nothing):
request = request = urllib2.Request(uri + nothing)
result = str(urllib2.urlopen(request).read())
if 'html' in result:
print("secret word :D -----> " + result)
sys.exit()
next_nothing = ''.join(re.findall('\d', ''.join(re.findall('nothing is \d+', result))))
if (next_nothing == ''):
next_nothing = str(int(nothing) / 2)
return next_nothing
i = 0
while (i <= 270):
nothing = get_next(nothing)
print(nothing)
i = i + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment