zoukankan      html  css  js  c++  java
  • Python3实现计算BMI指数,跟我一起来计算你的BMI吧

    废话不多说,直接上程序哈:
        name=input('Name:')
        height=input('Height(m):')
        weight=input('Weight(kg):')
        BMI=float(float(weight)/(float(height)**2))
        print('您的BMI指数为:',BIM)
        if BMI <18.5:
        print('你太轻了!')
        elif BMI<=25:
        print('标准体重哦哦!')
        elif BMI<=32:
        print('您有点微胖哦哦!')
        else:
        print('您太胖了,该减肥了')
    废话不多说,改进版继续上程序哈:
      def bmi():
      name=input('Name:')
      height=input('Height(m):')
      weight=input('Weight(kg):')
      BIM=float(float(weight)/(float(height)**2))
      print('您的BIM指数为:',BIM)
      if BIM <18.5:
      print('你太轻了!')
      elif BIM<=25:
      print('标准体重哦哦!')
      elif BIM<=32:
      print('您有点微胖哦哦!')
      else:
      print('您太胖了,该减肥了')
      bmi()
      for i in range(10):
      choose =input('您是否愿意继续计算BMI(y/n)')
      if choose=='y':
      bmi()
      else:
      break
     
     
  • 相关阅读:
    Django
    索引
    idea启动tomcat后控制台日志显示中文乱码问题
    Elasticsearch
    Hive 开窗函数
    hadoop-3.1.1集群搭建
    hadoop-2.6.5集群搭建
    spark集群搭建(spark版本2.3.2)
    Zookeeper
    spark-submit(spark版本2.3.2)
  • 原文地址:https://www.cnblogs.com/Michelle-Yang/p/6708296.html
Copyright © 2011-2022 走看看