User Tools

Site Tools


pythonchallenge

http://www.pythonchallenge.com/

0:

  • Change url from 0 to 1
  • print 2**38 and put the result to url again

1:

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))

2:

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]))

3:

print "".join(re.findall("[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]", s.replace("\n","")))

4:

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

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 =)

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

…and you'll see a “channel” made of “#“s

6:

pythonchallenge.txt · Last modified: 2017/01/05 06:55 by felixonmars