Python Class Constructor to find Area || Constructor || Python
In this we are going to see a basic example to find area using constructor in Python Programming Language.



class RectArea:
    def __init__(self, l, b):
        self.l = l
        self.b = b
        print(f"Area of Rectangle: ", self.l*self.b)

class CirArea:
    def __init__(self, r):
        self.r = r
        print(f"Area of Circle: ", 3.142*self.r*self.r)

r = RectArea(5.7, 6.2)
c = CirArea(5)

# Coded by Saahil  


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post