# C = ( F - 32 ) / 1.8????????????????????????????????????????????????????????????????????????????????
# F = C * 1.8 + 32????????????????????????????????????????????????????????????????????????????????
def tempConvert():
? ? t = input("請輸入數值:")
? ? C = ["c","C"]
? ? F = ["F","f"]
? ? if t[0] in C:
? ? ? ? temp = (float(t[1:])*1.8) +32
? ? ? ? temp = "{:.2f}".format(temp)
? ? ? ? temp = "F" + str(temp)
? ? ? ? print("結果:",temp)
? ? elif t[0] in F:
? ? ? ? temp =(float(t[1:])-32)/1.8
? ? ? ? temp = "{:.2f}".format(temp)
? ? ? ? temp = "C" + str(temp)
? ? ? ? print("結果:",temp)
? ? else:
? ? ? ? print("輸入格式錯誤")
? ? ? ? return False
? ? return temp
tempConvert()