条件语句,while循环语句:完整的温度转换程序

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;
  

posted @ 2018-04-23 16:51  哝哝  阅读(170)  评论(0编辑  收藏  举报