这是代码的a部分。
import math
length_centre=eval(input("Enter length from centre to corner of pentagon: "))
side_length= 2*length_centre*(math.sin(math.pi/5))
print(side_length)
areaP =(5((side_length)**2))/(4*((math.tan)((math.pi)/5)))
print(areaP)
代码错误:
面积=(5((4)**2))/(4*((数学。棕褐色)((数学.pi)/5) )) TypeError:“int”对象不可调用
编程语言不像书面数学那样有隐式乘法,因此
5((side_length)**2)
是不合法的,它试图将5
作为带有参数side_length ** 2
的函数调用。我猜你想要5 * side_length**2
(除去一些不需要的无关paren,因为求幂比其他数学运算绑定得更紧密)。在清理干净,你会有:
相关问题 更多 >
编程相关推荐