当我返回一个值时,它怎么不输出呢?这可能真的很简单......顺便说一句,我目前仍在学习 Python。我正在使用 Python 3.x。
def convert(operation, temp):
newTemp = 0
if (operation is 'F' or operation is 'f'):
newTemp = (9/5) * (temp + 32)
return newTemp
if (operation is 'C' or operation is 'c'):
newTemp = (5/9) * (temp - 32)
return newTemp
print ("What operation would you like to convert to? ")
op = input("(F)ahrenheit or (C)elsius: ")
print ()
temp = input("What is the temperature : ")
NewTemp = int(temp)
convert(op, NewTemp)
谢谢