符彬祺 作业

a=input('摄氏度转换为华氏度请按1\n华氏度转化为摄氏度按2\n')
if a=='1':
    celsius=float(input('输入摄氏温度'))
    fahrenheit=(celsius*9/5)+32
    print('{:.2f}摄氏温度转为华氏温度为{:.2f}'.format(celsius,fahrenheit))
else:
    f=float(input('请输入华氏温度:'))
    c=5/9*(f-32)
    print('{:2f}华氏温度转换为摄氏温度:{:.2f}'.format(f,c))

猜你喜欢

转载自www.cnblogs.com/kelphia/p/8920244.html