【发布时间】:2017-09-15 00:26:46
【问题描述】:
我是 python 新手,我的问题是当我想制作一个计算立方体体积的计算器时:
>>> print(int ** 3 (input ("Enter the side length: ")))
Enter the side length: 4
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
print(int ** 3 (input ("Enter the side length: ")))
TypeError: 'int' object is not callable
【问题讨论】:
-
int不是 Python 中的类型。 Python 是动态类型的,因此无法定义变量类型。 -
side_len = int(input('Enter side length: ')); print('The volume of the cube is: ', side_len ** 3)
标签: python calculator cube