Skip to content

Instantly share code, notes, and snippets.

@LouP-PV
Created November 28, 2017 15:51
Show Gist options
  • Save LouP-PV/65f3ff2ba2564e85a889787e993ba023 to your computer and use it in GitHub Desktop.
Save LouP-PV/65f3ff2ba2564e85a889787e993ba023 to your computer and use it in GitHub Desktop.
BMIを計算するpythonプログラムのサンプル
# BMI判定プログラム
weight = float(input("体重(kg)は?:"))
height = float(input("身長(cm)は?:")) / 100
bmi = round(weight / (height ** 2))
if bmi < 18.5:
result = "痩せ型"
elif (bmi >= 18.5) and (bmi < 25):
result = "標準体型"
elif (bmi >= 25) and (bmi < 30):
result = "肥満(軽)"
else:
result = "肥満(重)"
print("BMI: " + str(bmi))
print("判定: " + result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment