本文目錄一覽:
python bmi公式怎麼用
weight=int(raw_input(“請輸入體重(千克):”))
height=int(raw_input(“請輸入身高(米):”))
BMI=weight/(height*height)
print “BMI=”,BMI
if BMI19:
print「輕體重”
elif BMI=19 and BMI25:
print”健康身體”
elif BMI=25 and BMI28:
print”超重「
else:
print”肥胖」
raw_input(“press any key to quit.”)
Python計算BMI值
廢話不多說,改進版繼續上程序哈:
def bmi():
name=input(‘Name:’)
height=input(‘Height(m):’)
weight=input(‘Weight(kg):’)
BIM=float(float(weight)/(float(height)**2))
print(‘您的BIM指數為:’,BIM)
if BIM 18.5:
print(‘你太輕了!’)
elif BIM=25:
print(‘標準體重哦哦!’)
elif BIM=32:
print(‘您有點微胖哦哦!’)
else:
print(‘您太胖了,該減肥了’)
bmi()
for i in range(10):
choose =input(‘您是否願意繼續計算BMI(y/n):’)
if choose==’y’:
bmi()
else:
break
怎麼用python算bmi 簡單編程 在線等
weight=int(raw_input(“請輸入體重(千克):”))
height=int(raw_input(“請輸入身高(米):”))
BMI=weight/(height*height)
print “BMI=”,BMI
if BMI19:
print「輕體重”
elif BMI=19 and BMI25:
print”健康身體”
elif BMI=25 and BMI28:
print”超重「
else:
print”肥胖」
raw_input(“press any key to quit.”)
怎樣用python計算bmi
weight=int(raw_input(“請輸入體重(千克):”))
height=int(raw_input(“請輸入身高(米):”))
BMI=weight/(height*height)
print “BMI=”,BMI
if BMI19:
print「輕體重”
elif BMI=19 and BMI25:
print”健康身體”
elif BMI=25 and BMI28:
print”超重「
else:
print”肥胖」
raw_input(“press any key to quit.”)
python語言計算BMI值,感謝求解!
sg = input(‘你的身高多少(米):’)
tz = input(‘你的體重多少(公斤):’)
BMI = round(float(tz) / float(sg) ** 2, 1)
if BMI 18.5:
print(‘BMI={0},{1}’.format(BMI, ‘偏瘦’))
elif 18.5 = BMI 24.9:
print(‘BMI={0},{1}’.format(BMI, ‘標準’))
elif 25.0 = BMI 29.9:
print(‘BMI={0},{1}’.format(BMI, ‘超重’))
elif 25 = BMI:
print(‘BMI={0},{1}’.format(BMI, ‘肥胖’))
這是委託我讀五年級的兒子寫的。^_^
原創文章,作者:KOLV,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/143621.html