Python 3.2.5 (default, May 15 2013, 23:07:10) [MSC v.1500 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. #converting a number in a decimal representation to a binary rep. (b=2) #the function returns a string >>> bin(10) '0b1010' >>> _ '0b1010' >>> type(_) >>> type(bin(10)) >>> bin(12) '0b1100' #converting a number in a decimal representation to a hexadecimal rep. (b=16) #the function returns a string >>> hex(161) '0xa1' #converting a string representing a number in a given base (default b= 10) to an integer in a decimal rep. (b=10) >>> int("1100", 2) 12 >>> int("a1", 16) 161 >>> int("1100", 10) 1100 #Running the initial version of convert_base >>> ================================ RESTART ================================ >>> >>> convert_base(10, 2) '1010' >>> convert_base(0, 2) '' #Running the updated version of convert_base >>> ================================ RESTART ================================ >>> >>> convert_base(0, 2) '0' >>> convert_base(10, 16) '10' >>> convert_base(17, 16) '11' >>> hex(17) '0x11' >>> convert_base(161, 16) '101' >>> ================================ RESTART ================================ >>> >>> convert_base(161, 16) 'a1' #memory model #examples: >>> >>> >>> >>> >>> >>> def change_int(n): n = 999 >>> x = 10 >>> change_int(x) >>> x 10 >>> def add_to_list(lst): lst.append(999) >>> lst = [1,2,3] >>> add_to_list(lst) >>> lst [1, 2, 3, 999] >>> >>> >>> def change_list(l): l = [999, 999] >>> lst [1, 2, 3, 999] >>> change_list(lst) >>> lst [1, 2, 3, 999] >>> >>> lst = [3,2,1] >>> >>> lst [3, 2, 1] >>> id(lst) 41124872 >>> lst_new = lst >>> id(lst_new) 41124872 >>> lst.append(900) >>> id(lst) 41124872 >>> lst = lst + [10,20] >>> id(lst) 62397640 >>> id(lst_new) 41124872 >>>