0

値を返すと、なぜそれが出力されないのですか? それはおそらく本当に簡単です...ちなみに、私はまだ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)

ありがとう

4

2 に答える 2