JIECAO

使用判断语��实现 BMI 的计算。

BMI 指数(�身体质�指数,简称体质指数�称体�,英文为 Body Mass Index,简称BMI),是用体�公斤数除以身高米数平方得出的数字

#!/usr/bin/env python3

print('----欢迎使用BMI计算程�----')
name=input('请键入您的姓�:')
height=eval(input('请键入您的身高(m):'))
weight=eval(input('请键入您的体�(kg):'))
gender=input('请键入你的性别(F/M)')
BMI=float(float(weight)/(float(height)**2))
#公�
if BMI<=18.4:
    print('姓�:',name,'身体状�:�瘦')
elif BMI<=23.9:
    print('姓�:',name,'身体状�:正常')
elif BMI<=27.9:
    print('姓�:',name,'身体状�:超�')
elif BMI>=28:
    print('姓�:',name,'身体状�:肥胖')
import time;
#time模�
nowtime=(time.asctime(time.localtime(time.time())))
if gender=='F':
    print('感谢',name,'女士在',nowtime,'使用本程�,�您身体�康!')
if gender=='M':
    print('感谢',name,'先生在',nowtime,'使用本程�,�您身体�康!')