python - 面临错误:“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)
解决方案
prs
是一个整数。但是在第 5 行中,您输入了pra=(2*prs)((((prs**2)/4)
... 它是之后的第一个左括号,2*prs
这使 Python 认为您正在调用一个函数。在两者之间添加一个*
,因为我猜你正在成倍增加。
推荐阅读
- android-studio - 无法识别的 Android Studio 版本
- css - css动画向左移动,重新出现在右侧并继续向左
- amazon-ec2 - WSO2 API 管理器 - TypeError 无法在 API 中获取尝试
- csv - 将 CSV 加载到 Apache Beam 时如何处理换行符?
- vulkan - 如何使 VK_LAYER_KHRONOS_validation 可用?
- php - header("Location:") 函数在实时服务器上不起作用
- java - 如何阻止日食如此频繁地暂停?
- reactjs - 如何在反应中将大文件上传到cloudinary
- python - pip3 是否安装了 psycopg2,但无法导入 Visual Studio 代码
- r - 子集 n 向量的函数给出错误消息“维数不正确”