User Tools

Site Tools


pythonchallenge

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pythonchallenge [2017/01/05 06:55] (current)
felixonmars created
Line 1: Line 1:
 +http://​www.pythonchallenge.com/​
 +
 +0:
 +
 +  * Change url from 0 to 1
 +  * print 2**38 and put the result to url again
 +
 +1:
 +<​code>​
 +s = 'g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr\'​q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.'
 +frm = ''​.join([chr(c) for c in range(ord('​a'​),​ord('​z'​) + 1)])
 +to  = frm[2:] + '​ab'​
 +print s.translate(string.maketrans(frm,​ to))
 +</​code>​
 +
 +2:
 +<​code>​
 +t = {}
 +for c in s:
 +    if t.has_key(c):​
 +        t[c] += 1
 +    else:
 +        t[c] = 1
 +print s.translate(string.maketrans("",""​),​ ""​.join([x for x in table.keys() if table[x] > 100]))
 +</​code>​
 +
 +3:
 +<​code>​
 +print ""​.join(re.findall("​[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]",​ s.replace("​\n",""​)))
 +</​code>​
 +
 +4:
 +<​code>​
 +
 +import urllib2
 +
 +url = '​http://​www.pythonchallenge.com/​pc/​def/​linkedlist.php?​nothing='​
 +num = '​12345'​
 +
 +i = 0
 +while True:
 +    i += 1
 +    req = urllib2.Request(url + num)
 +    res = urllib2.urlopen(req)
 +    result = res.read()
 +    print result
 +    num = result.split('​ ')[-1]
 +    print num
 +</​code>​
 +You'll get "Yes. Divide by two and keep going."​ when nothing is 16044, so just change the num in code above to 8022 and keep going.
 +Finally you'll get it (peak.html)
 +
 +5:
 +peak hell == pickle of course =)
 +<​code>​
 +import pickle
 +
 +with open('​banner.p'​) as f:
 +    t = pickle.load(f)
 +    for l in t:
 +        for i in l:
 +            print '​\b'​+i[0]*i[1],​
 +        print
 +</​code>​
 +...and you'll see a "​channel"​ made of "#"​s
 +
 +6:
  
pythonchallenge.txt ยท Last modified: 2017/01/05 06:55 by felixonmars