python - 我在 Python 上不断收到错误,TypeError: unsupported operand type(s) for /: 'tuple' and '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? ") )
#计算
#FV = 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"))
推荐阅读
- java - Spark Rdd 输出到 Kafka 主题
- rust - 如何从 Actix-web 中 HTML 表单的 POST 请求中获取参数?
- android - 在 iOS 和 Android 上 memcpy() / mktime() 线程安全吗?
- python-3.x - python 中的 Selenium webdriver find_element_by_id() 方法使用 phantomjs 引发错误
- python - 将行转换为python中的列
- java - Selenium (Java):如何定位浏览器验证消息?
- excel - 优化宏:表格清空内容
- python - 使用 R/Python 将 SAS 文件 (sas7bdat) 转换为平面文件,没有内存限制
- arrays - 如果 AC-AF 列包含空白,则剪切并粘贴行
- php - WP_Query:meta_query 中的第二个参数被忽略