Python 程式用於計算你的體重指數(BMI)


我們需要輸入我們的身高和體重。我們的任務是使用公式計算 BMI。

演算法

Step 1: input height and weight of your body.
Step 2: then applying the formula for calculation BMI.
Step 3: display BMI.

示例程式碼

height = float(input("Enter your height(m): "))
weight = float(input("Enter your weight(kg): "))
print("Your BMI is: ", round(weight / (height * height), 2))

輸出

Enter your height (m): 5.8
Input your weight (kg): 64
Your body mass index is:  1.9

更新於: 30-7-2019

923 次瀏覽

啟動你的 職業

完成課程獲得認證

開始
廣告
© . All rights reserved.