diff --git a/work.py b/work.py index 93b75a2..46b6674 100644 --- a/work.py +++ b/work.py @@ -30,10 +30,14 @@ isCelsius = False if str(temp).__contains__("C"): isCelsius = True -temp = float(temp.replace("C", "")) +if isCelsius: + temp = float(temp.replace("C", "")) +else: + temp = float(temp.replace("F", "")) + #转换成华氏度 -if (isCelsius): +if isCelsius: print("Fahrenheit should be " + str(temp * 1.8 + 32)) else: print("Celsius should be " + str((temp - 32) / 1.8) )