# File: ChapterOO/ooarea.py """ OO Shapes: Square and Circle area of shape: 1 area of shape: 25 area of shape: 3.14 area of shape: 78.54 """ from math import pi class mySquare: def __init__(self,s): self.side = s def area(self): return self.side ** 2 class myCircle: def __init__(self,r): self.radius = r def area(self): return pi * self.radius ** 2 def main(): # make a list of shapes mylist= [mySquare(1),mySquare(5),myCircle(1),myCircle(5)] # print the coresponding areas for i in mylist: print("area of shape: ", round(i.area(),2) ) main()