int对象不可调用错误

3zz*_*zzy 1 python

我正在尝试这个例子:

在此输入图像描述

p = 10000
n = 12
r = 8
t = int(input("Enter the number of months the money will be compounded "))

a = p (1 + (r/n)) ** n,t

print (a)
Run Code Online (Sandbox Code Playgroud)

..但错误是:

TypeError: 'int' object is not callable

Python认为p是一个函数吗?如果是这样,如果没有导入模块,我有没有办法做到这一点?

谢谢!

Dav*_*son 5

将行更改为

a = p * (1 + (r/n)) ** (n * t)
Run Code Online (Sandbox Code Playgroud)

Python不会将彼此相邻的变量解释为相乘(也不会将其解释n, t为.