>>> print(3 + 4) 7 >>> 3 + 4 Out[1]: 7 >>> def printSum(a, b): ... print(a + b) ... >>> printSum(3, 4) 7 >>> def doSum(a, b): ... return a + b ... >>> doSum(3, 4) Out[1]: 7 >>> type(7) Out[1]: int >>> type(7.3) Out[1]: float >>> type(5 / 2) Out[1]: int >>> type(5 / 2.) Out[1]: float >>> type(doSum(3, 4)) Out[1]: int >>> type(doSum) Out[1]: function >>> type(printSum) Out[1]: function >>> type(printSum(3, 4)) 7 Out[1]: NoneType >>> doSum(3, 4) + doSum(5, 6) Out[1]: 18 >>> doSum(doSum(3, 4), doSum(5, 6)) Out[1]: 14 >>> printSum(3, 4) + printSum(5, 6) 7 11 Traceback (most recent call last): File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2803, in run_code exec code_obj in self.user_global_ns, self.user_ns File "", line 1, in printSum(3, 4) + printSum(5, 6) TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType' >>> doSum(3, 4) Out[1]: 7 >>> x = doSum(3, 4) >>> x Out[1]: 7 >>> type(x) Out[1]: int >>> x = 7.3 >>> type(x) Out[1]: float >>> x = 7.0 >>> type(x) Out[1]: float >>> x = int(x) >>> type(x) Out[1]: int