刚开始学习python,学完条件判断和逻辑运算,写了个根据身高体重反映身体指标的小测试,下面一起看看吧!
PS:本程序是在Python 3.7版本下编写。
# -*- coding: utf-8 -*-
height = input("请输入你的身高:");
f_height = float(height);
weight = input("请输入你的体重:");
f_weight = float(weight);
s1 = f_weight/(f_height*f_height);
if s1 < 18.5 :
print("您的体重指标是:过轻 注意增加饮食哦!");
elif s1 >= 18.5 and s1 <= 25.0 :
print("您的体重指标是:正常 保持不错,再接再厉!");
elif s1 >25.0 and s1 <=28.0 :
print("您的体重指标是:过重 每天运动半小时,还是很不错的哦!");
elif s1 >28.0 and s1 <=32.0 :
print("您的体重指标是:肥胖 哎呀呀,有点肚腩了呢。。。");
else:
print("您的体重指标是:严重肥胖 女朋友什么的就别想了,赶紧减肥吧!!");
欢迎朋友测试哦!!