fix error due to not process issues with temp detect
This commit is contained in:
parent
03d231d5ca
commit
a23f2c9989
8
work.py
8
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) )
|
||||
|
Loading…
Reference in New Issue
Block a user