DS1222B Write a python program to print the area and perimeter of a triangle using oops concepts, Make a class named triangle and define the functions area and perimeter in it

class poly:
def init(self,a,b,c):
self.a = float(a)
self.b = float(b)
self.c = float(c)
a= int(input(“a=”))
b= int(input(“b=”))
c= int(input(“c=”))

class triangle(poly):
def init(self,a,b,c):

def get_area(self):
    s = (a + b + c) / 2
    return (s*(s-a)*(s-b)*(s-c)) ** 0.5        

t = triangle(a,b,c)
print(“area : {}”.format(t.get_area()))


Correct Keep practicing @mayurpuranik9

1 Like