Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> bin(13) '0b1101' >>> b = bin(13) >>> b[2:] '1101' >>> b[2:5] '110' >>> b[2::3] '11' >>> hex(11) '0xb' >>> hex(31) '0x1f' >>> bin(31) '0b11111' >>> int("1101", 2) 13 >>> int("11111", 2) 31 >>> int("1f", 16) 31 >>> int("17", 7) Traceback (most recent call last): File "", line 1, in int("17", 7) ValueError: invalid literal for int() with base 7: '17' >>> int("16", 7) 13 >>> int("16", 40) Traceback (most recent call last): File "", line 1, in int("16", 40) ValueError: int() arg 2 must be >= 2 and <= 36 >>> int("u1z", 36) 38951 >>> Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> >>> convert_base(23, 37) Traceback (most recent call last): File "", line 1, in convert_base(23, 37) File "C:\Documents and Settings\eladlibm\Desktop\T3\convert_base.py", line 8, in convert_base assert 2<=b<=36 AssertionError >>> ================================ RESTART ================================ >>> >>> convert_base(11, 16) 'b' >>> convert_base(-11, 16) '-b' >>> convert_base(0, 16) '0' >>> convert_base(7, 3) '21' >>> convert_base(-7, 3) '-21' >>> Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> 10 non-efficient 0.0022273780606194365 efficient 0.0021282034448512318 >>> ================================ RESTART ================================ >>> 10 non-efficient 0.002357003473905203 efficient 0.002359797125053603 >>> ================================ RESTART ================================ >>> 100 non-efficient 0.002666540021147939 efficient 0.002831924169133228 >>> ================================ RESTART ================================ >>> 1000 non-efficient 0.003272203590121091 efficient 0.0027045336767661816 >>> ================================ RESTART ================================ >>> 1048576 non-efficient 0.3149218685615071 efficient 0.00312050833276295 >>> ================================ RESTART ================================ >>> 2097152 non-efficient 0.6756230191267326 efficient 0.002887238461871555 >>> ================================ RESTART ================================ >>> 2097152 non-efficient 0.6059884706017106 efficient 0.002857346394583682 >>> ================================ RESTART ================================ >>> 1073741824 non-efficient Traceback (most recent call last): File "C:\Documents and Settings\eladlibm\Desktop\T3\is_perfect.py", line 39, in sum_divisors1(n) File "C:\Documents and Settings\eladlibm\Desktop\T3\is_perfect.py", line 16, in sum_divisors1 return sum([i for i in range(1,n) if n%i==0]) File "C:\Documents and Settings\eladlibm\Desktop\T3\is_perfect.py", line 16, in return sum([i for i in range(1,n) if n%i==0]) KeyboardInterrupt >>> ================================ RESTART ================================ >>> 1073741824 efficient 0.008544382037381846 >>> Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> def f(num): num=0 >>> n = 8 >>> n 8 >>> f(n) >>> n 8 >>> def f2(lst): lst = [999,999,999] >>> l = [1,2,3] >>> f2(l) >>> l [1, 2, 3] >>> def f2(lst): lst[1] = 999 >>> l [1, 2, 3] >>> f2(l) >>> l [1, 999, 3] >>>