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(eval(TempStr[0:-1])*1.8+32)
print('转换后的温度为:[:.2F}F'·format(F))
else:
print('输入数据错误,请重新输入!')