首页 > 解决方案 > 我试图打印出这个简单的方程式,但它说浮动对象不可调用

问题描述

我一直在尝试打印出这个非常简单的方程式,但我不知道为什么它不会打印出来?

fc = float(input("first cycle is "))
fp = float(input("first percent is "))

sc = float(input("second cycle is "))
sp = float(input("second percent is "))

tc = float(input("third cycle is "))
tp = float(input("third percent is "))

mem = float(input("the memory is "))

first_part = (fc * fp + (sc(1-fp)))

print(first_part)

它给了我错误“TypeError:'float'对象不可调用”

标签: python

解决方案


*不能像在代数方程中那样省略乘法运算符。解释器认为sc(1-fp)是函数调用。

first_part = (fc * fp + (sc * (1-fp)))

推荐阅读