2017-09-15 68 views
-3

我是新來的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 
+0

'int'不是Python中的一種類型。 Python是動態類型的,因此沒有辦法定義變量類型。 – ifconfig

+1

'side_len = int(input('Enter side length:')); print('立方體的體積是:',side_len ** 3)' –

回答

2

int()功能應該環繞整個input()函數,像這樣的東西

print(int(input('Enter the side length:')) ** 3)