I am a beginner with Python and trying to calculate the area of a triangle. The task asks to define the area function, and I can't get it to return a valid value (should be float) to the main function.
from math import sqrt
def area(linea, lineb, linec):
"""function is supposed to find the area of the triangle"""
s = (linea + lineb + linec) // 2
a = sqrt(s * (s - linea) * (s - lineb) * (s - linec))
return a
def main():
linea = float(input("Enter the length of the first side: "))
lineb = float(input("Enter the length of the second side: "))
linec = float(input("Enter the length of the third side: "))
b = float(a)
print("The triangle's area is %0.2f" %b)
The print should give the area in 0.0 form. What should I do so that I don't get the error code "NameError:␣name␣'a'␣is␣not␣defined"?