Discuss / Python / 作业

作业

Topic source

print('输入体重(kg)') a=float(input()) while a == 0: print('体重输入错误,请重新输入。') a=float(input()) print('输入身高(cm)') b=float(input()) while b == 0: print('体重输入错误,请重新输入。') b=float(input())

c = a / ((b/100)**2) if c < 18.5: e='你过轻' elif c >= 18.5 and c< 25: e='你很正常' elif c >= 25 and c< 28: e='你过重' elif c >= 28 and c< 32: e='肥胖' elif c > 32: e='非常肥胖'

print ('你的体重', a ,'千克') print ('你的身高' ,b ,'厘米') print('你的IBM值',round(c,1),e)


  • 1

Reply