我是编程新手,所以这个问题可能很愚蠢。
我需要Tr1
在Bzero1
函数中引入的值。当我运行模块时,我得到以下结果:
。
该程序未运行该Bzero1
功能,我不确定为什么。是因为我没有Tr1
正确引入值还是其他?我想Bzero1
执行的操作0.083-(0.422/Tr1**1.6)
,与Tr1
从的结果得到的T/Tc1
。
非常感谢您的帮助。
T = float(input("Introduce system temperature in Kelvin: "))
print("System temperature is: ", T)
Tc1 = float(input("Introduce critical temperature of component 1: "))
print("Critical temperature of component 1 is: ", Tc1)
def Tr1(T, Tc1):
print("Relative temperature 1: ", T/Tc1)
Tr1 = Tr1(T, Tc1)
def Bzero1(Tr1):
print("Bzero 1: ", 0.083-(0.422/Tr1**1.6))
不要替换Tr1
函数值,以免发生这样的替换更改:
Tr1_value = Tr1(T, Tc1)
Bzero1
用以下代码调用函数:
Bzero1(Tr1_value)
修改Tr1
以返回值:
def Tr1(T, Tc1):
result = T/Tc1
print("Relative temperature 1: ", result)
return result
另外,让我建议您看一下python官方教程-在这里您可以学到很多有关python的知识...
祝你好运 !
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句