TypeError: areatriangle() takes 0 positional arguments but 2 were given
TypeError: areatriangle() takes 0 positional arguments but 2 were given
This tells us that the areatriangle() method takes no input parameters.
areatriangle(3,5)
You have given two arguments (breadth and height). Now Python has no idea what to do with them and raises an error.
You can use this:
def areatriangle(breadth, height):
area = .5 * breadth * height
return area # or you can do: return f"The area of a triangle of base {breadth} and height {height} is {area}"
area = areatriangle(3, 5)
print(area)