我在 Python 上不断收到错误,类型错误:不支持的操作数类型/:"元组"和"int" 我做错了什么?



复利计算器

#输入

P = (float, input("Enter the starting principal: ") )
R = (float, input("Enter the annual interest rate: ") )
m = (int, input("How many times per year is the interest compounded? ") )
t = (float, input("For how many years will the account earn interest? ") )

#计算#阵线= p * (1 + ((R/100)/m ) ) ** ( m * t)

FV = P * ( 1 + ( (R/100) / m ) ) ** ( m * t)

#输出
print("At the end of ", t, "years. You will have $", format(FV, ",.2f") ) 

正确语法:

input_variable = float(input("some text"))
input_variable= int(input("some text"))
P = float(input("Enter the starting principal: ") )
R = float(input("Enter the annual interest rate: ") )
m = int(input("How many times per year is the interest compounded? ") ) )
t = float(input("For how many years will the account earn interest? ") )
FV = P * ( 1 + ( (R/100) / m ) ) ** ( m * t)
print("At the end of ", t, "years. You will have $", format(FV, ",.2f") )

float, input("bla bla bla"))应该像float(input("bla bla bla"))),int, input("bla bla bla"))变成这样:int(input("bla bla bla"))

相关内容

  • 没有找到相关文章

最新更新