diff --git a/BMIC.py b/BMIC.py index e47ae8f..59e8afc 100644 --- a/BMIC.py +++ b/BMIC.py @@ -1,18 +1,8 @@ while True: - - w = input("输入体重[千克/公斤]\n[local]~#") - print() - h = input("输入身高[米]\n(带小数点)\n[local]~#:") - w = float(w) - h = float(h) - ht = h*h - ht = float(ht) - bmi = w/ht - bmi = str(bmi) - print() - print("您的BMI为:" + bmi) - print() - bmi = float(bmi) + w = float(input("输入体重[千克/公斤]\n[local]~#")) + h = float(input("\n输入身高[米]\n(带小数点)\n[local]~#:")) + bmi = w/(h**2) + print("\n您的BMI为:" + str(bmi) + "\n") if bmi < 18.5: print("您的体重偏轻!") @@ -33,5 +23,4 @@ print("您这...") print("赶紧打电话咨询营养师吧!") - print() - input("程序到此结束,按任意键继续!\n(程序会不停循环 直到您关掉为止)") \ No newline at end of file + input("\n程序到此结束,按任意键继续!\n(程序会不停循环 直到您关掉为止)") \ No newline at end of file