{"id":13149,"date":"2022-12-13T14:47:27","date_gmt":"2022-12-13T06:47:27","guid":{"rendered":"https:\/\/fgchen.com\/wpedu\/?p=13149"},"modified":"2026-03-30T14:32:37","modified_gmt":"2026-03-30T06:32:37","slug":"tqc-%e7%a8%8b%e5%bc%8f%e8%aa%9e%e8%a8%80python-406-%e4%b8%8d%e5%ae%9a%e6%95%b8%e8%bf%b4%e5%9c%88-bmi%e8%a8%88%e7%ae%97","status":"publish","type":"post","link":"https:\/\/fgchen.com\/wpedu\/2022\/12\/tqc-%e7%a8%8b%e5%bc%8f%e8%aa%9e%e8%a8%80python-406-%e4%b8%8d%e5%ae%9a%e6%95%b8%e8%bf%b4%e5%9c%88-bmi%e8%a8%88%e7%ae%97\/","title":{"rendered":"TQC+ \u7a0b\u5f0f\u8a9e\u8a00Python 406 \u4e0d\u5b9a\u6578\u8ff4\u5708-BMI\u8a08\u7b97"},"content":{"rendered":"1. \u984c\u76ee\u8aaa\u660e:\r\n\u8acb\u958b\u555fPYD406.py\u6a94\u6848\uff0c\u4f9d\u4e0b\u5217\u984c\u610f\u9032\u884c\u4f5c\u7b54\uff0c\u4f7f\u8f38\u51fa\u503c\u7b26\u5408\u984c\u610f\u8981\u6c42\u3002\u4f5c\u7b54\u5b8c\u6210\u8acb\u53e6\u5b58\u65b0\u6a94\u70baPYA406.py\u518d\u9032\u884c\u8a55\u5206\u3002\r\n\r\n2. \u8a2d\u8a08\u8aaa\u660e\uff1a\r\n\u8acb\u64b0\u5beb\u4e00\u7a0b\u5f0f\uff0c\u4ee5\u4e0d\u5b9a\u6578\u8ff4\u5708\u7684\u65b9\u5f0f\u8f38\u5165\u8eab\u9ad8\u8207\u9ad4\u91cd\uff0c\u8a08\u7b97\u51faBMI\u4e4b\u5f8c\u518d\u6839\u64da\u4ee5\u4e0b\u5c0d\u7167\u8868\uff0c\u5370\u51faBMI\u53ca\u76f8\u5c0d\u61c9\u7684BMI\u4ee3\u8868\u610f\u7fa9\uff08State\uff09\u3002\u5047\u8a2d\u6b64\u4e0d\u5b9a\u6578\u8ff4\u5708\u8f38\u5165-9999\u5247\u6703\u7d50\u675f\u6b64\u8ff4\u5708\u3002\u6a19\u6e96\u5982\u4e0b\u8868\u6240\u793a\uff1a\r\n\r\nBMI\u503c \u4ee3\u8868\u610f\u7fa9\r\nBMI &lt; 18.5 under weight\r\n18.5 &lt;= BMI &lt; 25 normal\r\n25.0 &lt;= BMI &lt; 30 over weight\r\n30 &lt;= BMI fat\r\n\u63d0\u793a\uff1a\r\n\u9ad4\r\n\u91cd\r\n\u8eab\r\n\u9ad8\r\n\uff0c\u8f38\u51fa\u6d6e\u9ede\u6578\u5230\u5c0f\u6578\u9ede\u5f8c\u7b2c\u4e8c\u4f4d\u3002 \u4e0d\u9700\u8003\u616e\u7537\u6027\u6216\u5973\u6027\u6a19\u6e96\u3002\r\n\r\n3. \u8f38\u5165\u8f38\u51fa\uff1a\r\n\u8f38\u5165\u8aaa\u660e\r\n\u5169\u500b\u6b63\u6578\uff08\u8eab\u9ad8cm\u3001\u9ad4\u91cdkg\uff09\uff0c\u76f4\u81f3-9999\u7d50\u675f\u8f38\u5165\r\n\r\n\u8f38\u51fa\u8aaa\u660e\r\n\u8f38\u51faBMI\u503c\r\nBMI\u503c\u4ee3\u8868\u610f\u7fa9\r\n\r\n\u8f38\u5165\u8207\u8f38\u51fa\u6703\u4ea4\u96dc\u5982\u4e0b\uff0c\u8f38\u51fa\u7684\u90e8\u4efd\u4ee5\u7c97\u9ad4\u5b57\u8868\u793a\r\n176\r\n80\r\nBMI: 25.83\r\nState: over weight\r\n170\r\n100\r\nBMI: 34.60\r\nState: fat\r\n-9999\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># TODO\r\nheight = eval(input())\r\nif height == -9999:\r\n    exit()\r\nweight = eval(input())\r\n\r\nwhile True:\r\n    height = height \/ 100\r\n    BMI = weight \/ (height * height)\r\n    print('BMI: %.2f' %(BMI) )  \r\n    if BMI &lt; 18.5:\r\n        print('State: under weight')\r\n    elif BMI &lt; 25: \r\n        print('State: normal')\r\n    elif BMI &lt; 30:\r\n        print('State: over weight')\r\n    else:\r\n        print('State: fat')\r\n\r\n    height = eval(input())\r\n    if height == -9999:\r\n      exit()\r\n    weight = eval(input())\r\n\r\n<\/pre>\r\n&nbsp;","protected":false},"excerpt":{"rendered":"<p>1. \u984c\u76ee\u8aaa\u660e: \u8acb\u958b\u555fPYD406.py\u6a94\u6848\uff0c\u4f9d\u4e0b\u5217\u984c\u610f\u9032\u884c\u4f5c\u7b54\uff0c\u4f7f\u8f38\u51fa\u503c\u7b26\u5408 &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[266],"tags":[],"class_list":["post-13149","post","type-post","status-publish","format-standard","hentry","category-266"],"_links":{"self":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/13149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/comments?post=13149"}],"version-history":[{"count":2,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/13149\/revisions"}],"predecessor-version":[{"id":13822,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/13149\/revisions\/13822"}],"wp:attachment":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/media?parent=13149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/categories?post=13149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/tags?post=13149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}