I am having trouble trying to input an area and parameter of a triangle using multiple functions. I just started learning defining functions and can't figure this out. The perimeter works just fine. I kept moving the hp equation around, but no luck. The area portion has me out of ideas, and I'm not sure where to go from here.
def perimeter(a,b,c):
return a + b + c
def area(hp, a, b, c):
return (hp * (hp - a) * (hp - b) * (hp - c)) ** (1/2)
def main():
a = eval(input("Enter side 'a': "))
b = eval(input("Enter side 'b': "))
c = eval(input("Enter side 'c': "))
hp = perimeter / 2
per = perimeter(a,b,c)
areaTri = area(hp,a,b,c)
print("\n",per)
print(areaTri)
main()
Error message: line 22, in main
hp = perimeter / 2
TypeError: unsupported operand type(s) for /: 'function' and 'int'
hp = perimeter((a,b,c)) / 2hp = perimeter(a,b,c) / 2eval()for this! You likely just needint().