class Given(): def __init__(self): self.radius = 3 self.pi = 3.14 self.stringforradius = str(self.radius) self.stringforpi = str(self.pi) def __str__(self): return("radius = {}, pi = {}, The area of the circle is {},radius = {}, pi = {}, The circumference of the circle is {} ".format (self.stringforradius, self.stringforpi, self.getcircumference,self.stringforradius, self.stringforpi, self.getarea)) class area(Given): def squared(self): self.square = self.radius * self.radius def area(self): self.ar = self.pi * self.square self.getarea = str(self.ar) class circumference(Given): def cir(self): self.cir1 = 2 * self.pi * self.radius self.getcircumference = str(self.cir1) gettingtotal = area() gettingtotal.squared() gettingtotal.area() gettingtotall = circumference() gettingtotall.cir() print(gettingtotal.__str__()) print(gettingtotall.__str__())
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)