首页 > 其他 > 详细

完整的温度转换程序

时间:2018-04-23 17:39:52      阅读:178      评论:0      收藏:0      [点我收藏+]
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> while True:
  a = input(1:摄氏度转华氏度\n2:华氏度转摄氏度\n3:退出\n)
  if a ==1:
      celsius=float(input(输入摄氏度:))
      fahrenheit=(celsius*9/5)+32
      print({:.2f}摄氏度转化为华氏度{:.2f}.format(celsius,fahrenheit))
  elif a ==2:
      fahrenheit=float(input(请输入华氏度:))
      celsius=9/5*(f-32)
      print({:.2f}华氏度转为摄氏度:{:.2f}.format(fahrehheit,celsius))
  else:
      break

 

完整的温度转换程序

原文:https://www.cnblogs.com/guanxunche/p/8920239.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!