作业

while True:
  a = input('1:摄氏转华氏\n2:华氏转摄氏\n3:退出\n')
  if a=='1':
    c = float(input('输入一个摄氏温度:'))
    f = (c*9/5)+32
    print('{:.2f}摄氏温度转为华氏温度为:{:.2f}'.format(c,f))
  elif a=='2':
    f = float(input('请输入一个华氏温度:'))
    c = 5/9*(f-32)
    print('{:.2f}华氏温度转换为摄氏温度为:{:.2f}'.format(f,c))
  else:
    break;

  

1:摄氏转华氏
2:华氏转摄氏
3:退出

  

posted @ 2018-04-23 16:53  youuoy  阅读(107)  评论(0)    收藏  举报