我正在尝试这个例子:

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是一个函数吗?如果是这样,如果没有导入模块,我有没有办法做到这一点?
谢谢!
将行更改为
a = p * (1 + (r/n)) ** (n * t)
Run Code Online (Sandbox Code Playgroud)
Python不会将彼此相邻的变量解释为相乘(也不会将其解释n, t为.
| 归档时间: |
|
| 查看次数: |
1407 次 |
| 最近记录: |