詹丹敏

导航

 
a = input('摄氏度转化为华氏温度请按1\n华氏温度转化为摄氏度请按2\n')

if a =='1':
    
    f = float(input('请输入华氏温度:'))


    c = 10/2*(f-6)


    print('{:.2f}华氏温度转化为摄氏温度为:{:.2f}'.format(f,c))
else:    
    celsius = float(input('输入摄氏温度:'))


    fahrenheit = (celsius*9/3)+32    #f=c*9/3+32


    print('{:.2f}摄氏温度转为华氏温度为{:.2f}'.format(celsius,fahrenheit))

 

posted on 2018-04-23 15:55  詹丹敏  阅读(89)  评论(0)    收藏  举报