Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> >>> T = "abcdabc" >>> inter = lz77_compress2(t) Traceback (most recent call last): File "", line 1, in inter = lz77_compress2(t) NameError: name 't' is not defined >>> inter = lz77_compress2(T) >>> inter ['a', 'b', 'c', 'd', [4, 3]] >>> b = inter_to_bin(inter) >>> b '01100001011000100110001101100100100000000010000011' >>> b[0] '0' >>> b[1:8] '1100001' >>> int(b[1:8],2) 97 >>> chr(97) 'a' >>> b[8] '0' >>> b[9:16] '1100010' >>> int(b[9:16],2) 98 >>> chr(98) 'b' >>> [chr(int(b[i+1:i+8],2)) for i in range(4)] ['a', 'B', '\x05', '\x0b'] >>> [chr(int(b[8*i+1:8*(i+1)],2)) for i in range(4)] ['a', 'b', 'c', 'd'] >>> b[32] '1' >>> b[33:45] '000000000100' >>> int(_,2) 4 >>> b[45:50] '00011' >>> b '01100001011000100110001101100100100000000010000011' >>> inter("a"*40) Traceback (most recent call last): File "", line 1, in inter("a"*40) TypeError: 'list' object is not callable >>> lz77_compress2("a"*40) ['a', [1, 31], [1, 8]] >>> 18/(31*7) 0.08294930875576037 >>> lz_ratio("a"*40) 0.15714285714285714 >>> lz_ratio("a"*100) 0.11428571428571428 >>> lz_ratio("a"*500) 0.08971428571428572 >>> lz_ratio("a"*2000\) SyntaxError: unexpected character after line continuation character >>> lz_ratio("a"*2000) 0.08414285714285714 >>> lz_ratio("a"*8000) 0.08321428571428571 >>>