用户:
VINSING渺宸查看:0 回复:3 评论:0 创建时间:2021-04-16T10:37:47
【作品展示】

【作品介绍】
六子
【作品源代码】
import turtle
#男生标准
light = 14.6
heavy = 21.8
fat = 24.5
#计算 BMI 值
myscreen = turtle.Screen()
height = float(myscreen.textinput("身高","请输入身高(m):"))
weight = float(myscreen.textinput("体重","请输入体重(kg):"))
bmi=weight / (height * height)
print(bmi)
# BMI 判断
if bmi <= light:
print("偏瘦")
elif bmi <= heavy:
print("正常")
elif bmi <= fat:
print("超重")
else:
print("肥胖")
#图像展示
mypen = turtle.Pen()
mypen.pensize(20)
# BMI 范围
mypen.pencolor("skyblue")
mypen.forward((light - 10) * 20)
mypen.pencolor("lightgreen")
mypen.forward((heavy - light) * 20)
mypen.pencolor("coral")
mypen.forward((fat - heavy) * 20)
mypen.pencolor("indianred")
mypen.forward(3 * 20)
#光标移动位置
mypen.penup()
mypen.goto((bmi - 10) * 20, 0)
mypen.dot(15, "gold")
mypen.hideturtle()
turtle.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn