首页 > 解决方案 > 面临错误:“TypeError:'int'对象不可调用”

问题描述

我写了这个程序来计算方形金字塔的面积。我面临一个错误,显示:“TypeError:'int' object is not callable”。这是我的代码的一部分,错误出现在编写公式的行中。

    elif shape3d=="5":
    prs=eval(input("Enter the value of Side of Base : "))
    prh=eval(input("Enter the value of Height : "))
    prv=(prh/3)*(prs**2)
    pra=(2*prs)((((prs**2)/4)+(prh**2))**0.5)+(prs**2)
    print("Volume = ",prv)
    print("Surface Area : ",pra)

标签: python

解决方案


prs是一个整数。但是在第 5 行中,您输入了pra=(2*prs)((((prs**2)/4)... 它是之后的第一个左括号,2*prs这使 Python 认为您正在调用一个函数。在两者之间添加一个*,因为我猜你正在成倍增加。


推荐阅读