Discuss / Python / 作业

作业

Topic source

王赛赛o_O

#1 Created at ... [Delete] [Delete and Lock User]

-- coding: utf-8 --

height = 1.75 weight = 80.5 bmi = weight/(height**2) if bmi < 18.5: print('light') elif 18.5 <= bmi and 25 >= bmi: print('normal') elif 25 < bmi and 28 > bmi: print('overweight') elif 28 <= bmi and 32 >= bmi: print('obesity') elif bmi > 32: print('severe obesity')

输出结果 overweight

大雯子PP

#2 Created at ... [Delete] [Delete and Lock User]

-- coding: utf-8 --

height=input('请输入您的身高(cm):') h=float(height) weight=input('请输入您的体重(kg):') w=float(weight) bmi=10000w/(hh) print('bmi=%.1f' % bmi) if bmi>32: print('您的体重爆灯T_T') elif bmi>=28: print('您的体重接近爆灯囧') elif bmi>=25: print('您有丢丢胖嘞- -') elif bmi>=18.5: print('标准身材哦^ ^') else: print ('一阵风就可以把你吹走...')


  • 1

Reply