# @Author : 望天宇八方清似玉
# @CreateTime: 2019/4/22 17:50
# @File : Temp.py
# @Software : PyCharm
TempStr = input("请输入带有符号的温度值: ")
if TempStr[-1] in ['F', 'f']:
C =(eval(TempStr[0:-1])-32)/1.8
print("转换后的温度是:{:.2f}C".format(C))
elif TempStr[-1] in ['C', 'c']:
F = 1.8*eval(TempStr[0:-1])+32
print("转换后的温度是:{:.2f}F".format(F))
else:print("你输入的格式有误")
Python实现简单温度转换(华氏温度)
猜你喜欢
转载自blog.csdn.net/weixin_41152743/article/details/89457724
今日推荐
周排行