import mathclass Point: def __init__( self, xValue = 0, yValue = 0 ): self.x = xValue self.y = yValueclass Circle( Point ): def __init__( self, x = 0, y = 0, radiusValue = 0.0 ): Point.__init__( self, x, y ) # call base-class constructor self.radius = float( radiusValue ) def area( self ): return math.pi * self.radius ** 2circle = Circle( 37, 43, 2.5 ) # create Circle objectprint "X coordinate is:", circle.xprint "Y coordinate is:", circle.yprint "Radius is:", circle.radiuscircle.radius = 4.25circle.x = 2circle.y = 2print circleprint "area: %.2f" % circle.area()
Name (required)
email (will not be published) (required)
Website