All pastes #432158 Raw Edit

Class Square

public python v1 · immutable
·published 2007-04-10 02:28 UTC
rendered paste body
class Square:    def __init__(self, side_length):        self.side_len = side_length    def calcA(self):        return self.side_len**2class Circle:    def __init__(self, rad):        self.rad = radius    def calcA(self):        import math        return math.pi*(self.rad**2)    print "test program"print ""print "Type '2' for calculating any square's area"print "Type '1' for calculating any circle's area"choice = input("Your choise: ")if  choice == 1:     radius = input("What is the circle's radius?: ")     c = Circle(radius)     print "The area is: %d" % c.calcA()elif choice == 2:     side_length = input("What is the square's side length? ")     s = Square(side_length)     print "The area is: %d" % s.calcA()else:  print("Wrong input")