def sqrt(number):
number = root**2
return root
def area_triangle(a, b, c):
x = (a+b+c)/2
result = x*(x-a)*(x-b)*(x-c)
print (sqrt(result))
area_triangle(4,5,6)
Run Code Online (Sandbox Code Playgroud)
这给我一个名称错误,其中“ NameError:未定义名称'root'”
我想在没有math.sqrt的情况下执行此操作,或者root = number**(1/2)
不使用这两个方法如何解决此问题,如果使用替代方法,为什么不会出现与“ NameError:未定义名称'number'相同的错误”?