#tempstr.py
tempstr = input("请输入转换的温度:")
if tempstr[-1] in ['c', 'C']:
F = eval(tempstr[0:-1])*1.8+32
print("转换后的华氏温度为:{:.2f}F".format(F))
elif tempstr[-1] in ['f', 'F']:
C = (eval(tempstr[0:-1])-32)/1.8
print("转换后的摄氏温度为:{:.2f}C".format(C))
else:
print("请输入正确的温度!")
07-16
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-14
1385
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-16
229
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交