猫史档案馆


【Python作品分享】BMI计算器【作品秀】

用户:不打扰X_-Q不打扰X_-Q查看:0 回复:1 评论:0 创建时间:2021-11-14T14:36:42


【作品展示】

center_image

 

【作品介绍】

BMI计算器

 

【作品源代码】

weight=float(input("Please enter your weight:")) #输入体重
height=float(input("Please enter your height:")) #输入身高
BMI=weight/(height**2) #计算BMI
print(BMI) #输出数据

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
BKS乄MCproblemBKS乄MCproblem

import turtle

__Pen=turtle.Pen()
height=float(input("你的身高?(厘米)"))
weight=float(input("你的体重?(公斤)"))
height=height/100#转换米
bmi=weight/(height*height)
if bmi>32:
    print("喵")
elif bmi>=28:
    print("肥胖")
elif bmi>24:
    print("过重")
elif bmi>=18.5:
    print("普通")
elif bmi<=18.5:
    print("过轻")
__Pen.pu()
__Pen.goto(-300,0)
__Pen.pd()
for i in range(500):
    __Pen.forward(1)
    if i==18.5*10:
        __Pen.dot(5)
    if i==24*10:
        __Pen.dot(5)
    if i==int(bmi*10):
        __Pen.pencolor("red")
        __Pen.dot(5)
        __Pen.pencolor("black")
turtle.done()

点赞0


评论