Write a function to return the area of triangle by heros formula


Topic: Write a function to return the area of triangle by heros formula

Solution

def cal_triangle_area(a:float,b:float,c:float)->float:
    if a or b or c:
        s = (a+b+c)/2
        if s>a and s>b and s>c:
            area = (s*(s-a)*(s-b)*(s-c))**(1/2)
            return round(area,2)
        else:
            return None
    return None



List all Python Programs