>>> x = 37 >>> x 37 >>> y = 5 >>> print "x+y = ", x+y x+y = 42 >>> side1 = 3.0 >>> side2 = 4.0 >>> import math >>> # formula for getting the length of the opposing side >>> # of a right-angled triangle >>> hypotenuse = math.sqrt(side1*side1+side2*side2) >>> hypotenuse 5.0 >>> import math >>> def hypotenuse(side1, side2): return math.sqrt(side1**2+side2**2) >>> # x**2 is shorthand for x*x >>> hypotenuse(6.0,8.0) 10.0 >>> class hypotenuse: def __init__(self,side1,side2): self.sideA = side1 self.sideB = side2 def calculate(self): return math.sqrt(self.sideA**2+self.sideB**2) >>> h = hypotenuse(6.0,8.0) >>> h.calculate() 10.0 >>> # put the hypotenuse class into a separate module, >>> # as the file myhypotenuse.py >>> import myhypotenuse >>> h = myhypotenuse.hypotenuse(6.0,8.0) >>> h.calculate() 10.0 >>> # now edit myhypotenuse in a text editor (changing >>> # the calculate function) >>> # and reload the modified version >>> reload(myhypotenuse) >>> h2 = myhypotenuse.hypotenuse(6.0,8.0) >>> h2.calculate() hypotenuse : 10.0