{"id":686,"date":"2022-01-29T21:22:50","date_gmt":"2022-01-29T13:22:50","guid":{"rendered":"https:\/\/yowlab.idv.tw\/wordpress\/?p=686"},"modified":"2022-01-29T21:53:53","modified_gmt":"2022-01-29T13:53:53","slug":"%e7%ad%86%e8%a8%98%e3%80%90%e8%8c%b6%e7%b1%b3%e8%80%81%e5%b8%ab%e6%95%99%e5%ae%a4%e3%80%912022-%e6%9c%80%e6%96%b0%e7%89%88python%e5%9f%ba%e7%a4%8e%e5%85%a5%e9%96%80%e8%aa%b2%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/yowlab.idv.tw\/wordpress\/?p=686","title":{"rendered":"[\u7b46\u8a18]\u3010\u8336\u7c73\u8001\u5e2b\u6559\u5ba4\u30112022 \u6700\u65b0\u7248Python\u57fa\u790e\u5165\u9580\u8ab2\u7a0b"},"content":{"rendered":"<p>Python \u4e00\u76f4\u662f\u6211\u6975\u60f3\u5b78\u7fd2\uff0c\u537b\u53c8\u4e00\u76f4\u7121\u75be\u800c\u7d42\u7684\u5931\u6557\u76ee\u6a19\uff0c\u7576\u7136\u81ea\u5df1\u7684\u7121\u6046\u6bc5\u529b\u662f\u6700\u5927\u95dc\u4fc2\uff0c2012 \u5e74\u521d\u6642\u77e5\u9053\u5076\u50cf\u8336\u7c73\u8001\u5e2b\u9858\u610f\u5c07\u4ed6\u7684\u5fc3\u8840\u7d50\u6676\u5206\u4eab\u51fa\u4f86\uff0c\u4fbf\u6eff\u61f7\u671f\u5f85\uff0c\u88dc\u5b8c\u8ab2\u4e4b\u5f8c\uff0c\u679c\u7136\uff5e\u539f\u4f86\u540d\u5e2b\u4e0d\u662f\u6d6a\u5f97\u865b\u540d\uff0c\u5728\u6559\u5b78\u6b77\u7a0b\u4e4b\u4e2d\uff0c\u771f\u7684\u85cf\u4e86\u597d\u591a\u300c\u6487\u6b65\u300d\u3002<\/p>\n<style type=\"text\/css\">\n    li.present01 {line-height:1.5em; background-color:#F5E5C9; padding:5px; border-radius:10px; font-weight:bold; margin:5px;}\n    li.present02 {line-height:1.5em; background-color:#D1EC87; padding:5px; border-radius:10px; font-weight:bold; margin:5px;}\n    ul.none {list-style-type:none;line-height:1.5em; padding:10px;}\n    ol.lower-roman {list-style-type:lower-roman;}\n    ul.note {line-height:1.5em; padding:2px; font-weight:bold; font-size:0.9em;}\n    .highlight01 {font-weight:bold; line-height:1.5em; background-color:#e7f49c; padding:3px 10px; border:2px; border-radius:10px;}\n    .highlight02 {font-weight:bold; line-height:1.5em; background-color:#F2F26B; padding:3px 10px; border:2px; border-radius:10px;}\n    .highlight03 {font-weight:bold; line-height:1.5em; background-color:#F9BF72; padding:3px 10px; border:2px; border-radius:10px;}\n    .box01 {font-weight:bold; line-height:1.5em; padding:10px 20px; border:1px #19130B solid; border-radius:5px;}\n<\/style>\n<p><span class=\"highlight01\">\u611f\u8b1d\u8336\u7c73\u8001\u5e2b\u4ee5\u53ca\u4fc3\u6210\u9019\u4e00\u5207\u7684\u74b0\u5883\u56e0\u7de3\uff0c\u8b93\u6211\u6df1\u6709\u6240\u5f97\u3002<\/span><\/p>\n<p>\u5f71\u7247\u5171\u6709\u5169\u96c6\uff1a<\/p>\n<ol>\n<li class=\"present01\">\u3010\u8336\u7c73\u8001\u5e2b\u6559\u5ba4\u30112022 \u6700\u65b0\u7248Python\u57fa\u790e\u5165\u9580\u8ab2\u7a0b(\u4e0a)<\/li>\n<p>    <iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/qB6_VrYWpN8\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>\u6211\u7684\u7b46\u8a18\uff1a<\/p>\n<ol>\n<li class=\"present02\">Google Colab \u7533\u8acb\u555f\u7528\u8207\u8a2d\u5b9a\uff01\uff08<a href=\"https:\/\/colab.research.google.com\/notebooks\/welcome.ipynb?hl=zh-tw\" rel=\"noopener\" target=\"_blank\">https:\/\/colab.research.google.com\/notebooks\/welcome.ipynb?hl=zh-tw<\/a>\uff09<\/li>\n<p>             Colab (\u5168\u540d\u70ba\u300cColaboratory\u300d) \u53ef\u8b93\u4f60\u5728\u700f\u89bd\u5668\u4e2d\u7de8\u5beb\u53ca\u57f7\u884c Python \u7a0b\u5f0f\u78bc\uff0c\u4e26\u5177\u6709\u4ee5\u4e0b\u512a\u9ede\uff1a<span class=\"highlight03\">\u4e0d\u5fc5\u9032\u884c\u4efb\u4f55\u8a2d\u5b9a\u3001\u514d\u8cbb\u4f7f\u7528 GPU\u3001\u8f15\u9b06\u5171\u7528<\/span>\u3002<\/p>\n<li class=\"present02\">\u53c8 Colab \u5728\u57f7\u884c\u6642\uff0c\u672c\u8eab\u4fbf\u662f\u4e00\u90e8\u865b\u64ec\u6a5f\uff0c\u4f5c\u696d\u7cfb\u7d71\u70ba\u300c<span class=\"highlight03\">Debain Linux\uff08buster\/sid\uff09<\/span>\u300d\uff0c\u9019\u9817\u4ee4\u6211\u5927\u958b\u773c\u754c\u5440\u3002<\/li>\n<li class=\"present02\">\u5e38\u7528 Markdown \u8a9e\u6cd5\u7c21\u8ff0<\/li>\n<p>                     \u96d6\u7136\u81ea\u5df1\u5df2\u6709\u5728\u5c0f\u5e45\u4f7f\u7528\uff0c\u4f46\u518d\u807d\u8336\u7c73\u8001\u5e2b\u5206\u4eab\u4e00\u6b21\u5f8c\uff0c\u53c8\u662f\u53e6\u7a2e\u611f\u53d7\u8207\u6536\u7a6b\uff01<\/p>\n<li class=\"present02\">\u4fe1\u6ea2\u8001\u5e2b\u7684\u5b78\u7fd2\u7b46\u8a18\u5206\u4eab\uff01\uff08\u9019\u6211\u53ea\u80fd\u9060\u89c0\u4e86\uff09<\/li>\n<li class=\"present02\">\u8b8a\u6578\u8a2d\u5b9a \u8207 \u9451\u5225 \u5206\u6cd5<\/li>\n<p>                     \u6b64\u6b21\u4ecb\u7d39\u7684\u8b8a\u6578\u578b\u614b\uff0c\u5927\u81f4\u53ef\u5206<span class=\"highlight03\"> int(), float(), str(), Bool() <\/span>\u56db\u7a2e\u5e38\u7528\u578b\u614b\u3002<\/p>\n<p>                     \u53ef\u5229\u7528<span class=\"highlight03\"> type() <\/span>\u4f86\u67e5\u8a62\u8b8a\u6578\u578b\u614b\uff01<\/p>\n<li class=\"present02\">\u8f38\u5165\u8207\u8f38\u51fa<\/li>\n<p>                     <span class=\"highlight03\">input()<\/span> , \u5f9e\u9375\u76e4\u9032\u4f86\u7684\u8cc7\u6599\uff0c\u90fd\u662f\u300c\u5b57\u4e32\u300d\uff0c\u82e5\u9700\u300c\u904b\u7b97\u300d\uff0c\u5247\u9700\u8981\u300c\u8f49\u63db\u300d\u8cc7\u6599\u578b\u614b\u3002<\/p>\n<p>                     <span class=\"highlight03\">print()<\/span>\uff0c\u5c07\u8655\u7406\u7d50\u679c\u8f38\u51fa\uff0c\u9810\u8a2d\u6700\u5f8c\u9762\u70ba\u300c\u63db\u884c\uff08\\n\uff09\u300d\u3002<br \/>\n\u53ef\u4ee5\u4f7f\u7528<span class=\"highlight03\"> end=&#8221;  &#8221; <\/span>\u4f86\u8a2d\u7f6e\u8f38\u51fa\u4e4b\u5f8c\uff0c\u6700\u5f8c\u9762\u7684\u300c\u7b26\u865f\u300d\u3002<br \/>\n<span class=\"highlight03\">sep=&#8221;  &#8221; <\/span>\u5247\u662f\u6bcf\u500b\u5143\u7d20\u4e4b\u9593\u53ef\u4ee5\u653e\u7f6e\u7684\u300c\u7b26\u865f\u300d\u3002\uff08\u9019\u5c0d\u6211\u4f86\u8aaa\uff0c\u975e\u5e38\u91cd\u8981\u8207\u597d\u7528\u5440\uff01\uff09<\/p>\n<li class=\"present02\">\u6709\u57fa\u790e\u7684\u4eba\uff0c\u4e5f\u8a31\u76f4\u63a5\u8df3\u300c\u4e0b\u96c6\u300d\u4fbf\u53ef\u3002<\/li>\n<p>                    &nbsp;<\/p>\n<\/ol>\n<li class=\"present01\">\u3010\u8336\u7c73\u8001\u5e2b\u6559\u5ba4\u30112022 \u6700\u65b0\u7248Python\u57fa\u790e\u5165\u9580\u8ab2\u7a0b(\u4e0b)<\/li>\n<p>     \u5f71\u7247<br \/>\n        <iframe loading=\"lazy\" title=\"\u3010\u8336\u7c73\u8001\u5e2b\u6559\u5ba4\u30112022 \u6700\u65b0\u7248Python\u57fa\u790e\u5165\u9580\u8ab2\u7a0b(\u4e0b)\" width=\"530\" height=\"298\" src=\"https:\/\/www.youtube.com\/embed\/U3PEJgPhdPk?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>\u6211\u7684\u7b46\u8a18\uff1a<\/p>\n<ol>\n<li class=\"present02\">print()\u547d\u4ee4<\/li>\n<p>                   \u8a9e\u6cd5\uff1a<br \/>\n                   <span class=\"highlight03\">print(\u9805\u76ee1, \u9805\u76ee2, \u9805\u76ee3,&#8230;., sep=&#8221;\u5206\u9694\u5b57\u5143&#8221;, end=&#8221;\u7d50\u675f\u5b57\u5143&#8221;)<\/span><\/p>\n<li class=\"present02\">\u8a3b\u89e3<\/li>\n<p>                   \u55ae\u884c\uff0c\u7528\u300c#\u300d\uff0c\u4f8b\u5982\uff1a<span class=\"highlight03\"># \u8a3b\u89e3\u5167\u5bb9<\/span>\u3002<br \/>\n                   \u591a\u884c\uff0c\u7528\u5169\u500b\u300c&#8221;&#8221;&#8221;\u300d\u593e\u4f4f\u8a3b\u89e3\u5167\u5bb9\uff0c\u4f8b\u5982\uff1a<span class=\"highlight03\">&#8220;&#8221;&#8221;  \u8a3b\u89e3\u5167\u5bb9  &#8220;&#8221;&#8221;<\/span>\u3002<\/p>\n<li class=\"present02\">\u904b\u7b97\u7b26\u865f<\/li>\n<ul>\n<li>\u7b97\u8853\u904b\u7b97\u7b26\u865f\uff1a<\/li>\n<p>                          +\u3001 -\u3001 *\u3001 \/\u3001 %(mod, \u6c42\u300c\u9918\u300d\uff09\u3001 \/\/\uff08\u6c42\u300c\u5546\u300d\uff09\u3001 **\uff08\u300c\u6307\u6578\u300d\u8a08\u7b97\uff09<\/p>\n<li>\u6bd4\u8f03\u904b\u7b97\u7b26\u865f\uff1a<\/li>\n<p>                          ==\u3001 !=\u3001 >\u3001 >=\u3001 <\u3001 <=\n\t              \n\n<li>\u908f\u8f2f\u904b\u7b97\u7b26\u865f\uff1a<\/li>\n<p>                          not\u3001 and\u3001or<\/p>\n<li>\u8907\u5408\u6307\u5b9a\u904b\u7b97\u7b26\u865f\uff1a<\/li>\n<p>                          +=\u3001 -=<\/p>\n<li>\u904b\u7b97\u7b26\u865f\u512a\u5148\u6b0a<\/li>\n<p>                          <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_135726.png\" alt=\"\" width=\"627\" height=\"432\" class=\"aligncenter size-full wp-image-709\" srcset=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_135726.png 627w, https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_135726-350x241.png 350w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/>\n                    <\/ul>\n<p>                    &nbsp;&nbsp;<\/p>\n<li class=\"present02\">\u5224\u65b7\u5f0f<\/li>\n<ul>\n<li>\u5faa\u5e8f\u7d50\u69cb\uff0c\u7a0b\u5f0f\u9810\u8a2d\u57f7\u884c\u65b9\u5f0f\u3002<\/li>\n<p>                           <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_143304-233x350.png\" alt=\"\" width=\"233\" height=\"350\" class=\"aligncenter size-medium wp-image-716\" srcset=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_143304-233x350.png 233w, https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_143304.png 384w\" sizes=\"auto, (max-width: 233px) 100vw, 233px\" \/><\/p>\n<li>\u9078\u64c7\u7d50\u69cb\uff0c\u689d\u4ef6\u5f0f\u5224\u65b7\u7684\u9078\u64c7\u57f7\u884c\u65b9\u5411\uff0c\u53ef\u5206\u70ba\uff1a\u55ae\u5411\u5224\u65b7\u3001\u96d9\u5411\u5224\u65b7\u3001\u591a\u65b9\u5224\u65b7\u4e09\u7a2e\u3002<\/li>\n<p>                           <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_144827.png\" alt=\"\" width=\"386\" height=\"402\" class=\"aligncenter size-full wp-image-723\" srcset=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_144827.png 386w, https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_144827-336x350.png 336w\" sizes=\"auto, (max-width: 386px) 100vw, 386px\" \/><\/p>\n<div class=\"box01\">\n                               \u8a9e\u6cd5\uff1a<br \/>\n                                 if \u689d\u4ef6\u5f0f\uff1a<br \/>\n                                 &nbsp;&nbsp;\u7a0b\u5f0f\u5340\u584a                              <\/p>\n<blockquote><p>\n                                  \u4f8b\uff1a<br \/>\n                                  if ( \u570b\u8a9e\u6210\u7e3e >= 60\uff09:<br \/>\n                                  &nbsp;&nbsp; print(&#8220;\u53ca\u683c\uff01&#8221;)\n                               <\/p><\/blockquote><\/div>\n<p>                              &nbsp;&nbsp;<\/p>\n<hr\/>\n<p>                           <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_144841.png\" alt=\"\" width=\"457\" height=\"418\" class=\"aligncenter size-full wp-image-722\" srcset=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_144841.png 457w, https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_144841-350x320.png 350w\" sizes=\"auto, (max-width: 457px) 100vw, 457px\" \/><\/p>\n<div class=\"box01\">\n                               \u8a9e\u6cd5\uff1a<br \/>\n                                 if \u689d\u4ef6\u5f0f\uff1a<br \/>\n                                 &nbsp;&nbsp;\u7a0b\u5f0f\u5340\u584a 1<br \/>\n                                 else :<br \/>\n                                 &nbsp;&nbsp;\u7a0b\u5f0f\u5340\u584a 2<\/p>\n<blockquote><p>\n                                 \u4f8b\uff1a<br \/>\n                                  if ( \u570b\u8a9e\u6210\u7e3e >= 60\uff09:<br \/>\n                                  &nbsp;&nbsp; print(&#8220;\u53ca\u683c\uff01&#8221;)<br \/>\n                                  else :<br \/>\n                                  &nbsp;&nbsp;print(&#8220;\u4e0d\u53ca\u683c\uff01&#8221;)\n                               <\/p><\/blockquote><\/div>\n<p>                             &nbsp;&nbsp;<\/p>\n<hr\/>\n<p>                            <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_144906-350x258.png\" alt=\"\" width=\"350\" height=\"258\" class=\"aligncenter size-medium wp-image-721\" srcset=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_144906-350x258.png 350w, https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_144906.png 560w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><\/p>\n<div class=\"box01\">\n                               \u8a9e\u6cd5\uff1a<br \/>\n                              if \u689d\u4ef6\u5f0f\uff1a<br \/>\n                              &nbsp;&nbsp;\u7a0b\u5f0f\u5340\u584a 1<br \/>\n                              elif :<br \/>\n                              &nbsp;&nbsp;\u7a0b\u5f0f\u5340\u584a 2<br \/>\n                              elif :<br \/>\n                              &nbsp;&nbsp;\u7a0b\u5f0f\u5340\u584a 3<br \/>\n                              &nbsp;&nbsp;  &#8230;&#8230;&#8230;<br \/>\n                              else :<br \/>\n                              &nbsp;&nbsp;\u7a0b\u5f0f\u5340\u584a 4<\/p>\n<blockquote><p>\n                              \u4f8b\uff1a<br \/>\n                              if ( \u570b\u8a9e\u6210\u7e3e >= 90\uff09:<br \/>\n                              &nbsp;&nbsp; print(&#8220;\u975e\u5e38\u597d\uff01&#8221;)<\/p>\n<p>                              elif ( \u570b\u8a9e\u6210\u7e3e >= 75\uff09:<br \/>\n                              &nbsp;&nbsp; print(&#8220;\u4e0d\u592a\u5999\uff01&#8221;)<\/p>\n<p>                              elif ( \u570b\u8a9e\u6210\u7e3e >= 60\uff09:<br \/>\n                              &nbsp;&nbsp; print(&#8220;\u8981\u52a0\u6cb9\u5566\uff01&#8221;)<\/p>\n<p>                              else :<br \/>\n                              &nbsp;&nbsp;print(&#8220;\u4e0d\u53ca\u683c\uff01&#8221;)\n                               <\/p><\/blockquote><\/div>\n<p>                             &nbsp;&nbsp;<\/p>\n<hr\/>\n<li>\u91cd\u8907\u7d50\u69cb\uff0c\u53ef\u4ee5\u91cd\u8907\u57f7\u884c\u6307\u5b9a\u7684\u7a0b\u5f0f\u78bc\uff0c\u7576\u7136\u4e5f\u6709\u505c\u6b62\u57f7\u884c\u7684\u689d\u4ef6\uff0c\u6216\u7a31\u70ba\u300c\u8ff4\u5708\u63a7\u5236\u300d\u3002<\/li>\n<p>                            <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_143902-e1643438730962-275x350.png\" alt=\"\" width=\"275\" height=\"350\" class=\"aligncenter size-medium wp-image-717\" srcset=\"https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_143902-e1643438730962-275x350.png 275w, https:\/\/yowlab.idv.tw\/wordpress\/wp-content\/uploads\/2022\/01\/Screenshot_20220129_143902-e1643438730962.png 478w\" sizes=\"auto, (max-width: 275px) 100vw, 275px\" \/><\/p>\n<\/ul>\n<li class=\"present02\">\u81ea\u8a02\u51fd\u5f0f\uff08\u985e\u4f3c\u300c\u9ed1\u76d2\u5b50\u300d\uff1f\uff09<\/li>\n<ul>\n<li>\u76f4\u63a5\u57f7\u884c\uff0c\u55ae\u7d14\u81ea\u8aaa\u81ea\u8a71\u7684\u51fd\u5f0f<\/li>\n<div class=\"box01\">\n                                      \u4f8b\uff1a<br \/>\n                                         \u5b9a\u7fa9 sayHello \u51fd\u5f0f\uff0c\u547c\u53eb\u5f8c\u300c\u50c5\u300d\u8f38\u51fa\u300cHello\u300d!<br \/>\n                                       <code><br \/>\n                                         def sayHello():<br \/>\n                                             &nbsp;&nbsp;print(\"Hello\")<\/p>\n<p>                                         sayHello()<br \/>\n                                       <\/code>\n                                     <\/div>\n<p>                                     &nbsp;&nbsp;<\/p>\n<li>\u53ef\u63a5\u53d7\u5916\u9762\u50b3\u5165\u4e00\u500b\u6216\u4e00\u500b\u4ee5\u4e0a\u53c3\u6578\u7684\u51fd\u5f0f<\/li>\n<div class=\"box01\">\n                                      \u4f8b\uff1a<br \/>\n                                         \u5b9a\u7fa9 sayHello \u51fd\u5f0f\uff0c\u53ef\u96a8\u610f\u63a5\u53d7\u4eba\u540d\uff0c\u547c\u53eb\u5f8c\u8f38\u51fa\u6307\u5b9a\u7684\u4eba\u540d\uff0c\u300cHello, \u4eba\u540d\u300d!<br \/>\n                                       <code><br \/>\n                                         def sayHello(name):<br \/>\n                                             &nbsp;&nbsp;print(\"Hello,\", name)<\/p>\n<p>                                         sayHello(\"John\")<br \/>\n                                         sayHello(\"Mary\")<br \/>\n                                       <\/code>\n                                     <\/div>\n<p>                                     &nbsp;&nbsp;<\/p>\n<li>\u4e0d\u4f46\u53ef\u63a5\u53d7\u5916\u9762\u50b3\u5165\u53c3\u6578\uff0c\u9084\u53ef\u5c07\u8655\u7406\u5b8c\u5f8c\u7684\u7d50\u679c\u56de\u50b3<\/li>\n<div class=\"box01\">\n                                      \u4f8b\uff1a<br \/>\n                                         \u5b9a\u7fa9 sayHello \u51fd\u5f0f\uff0c\u53ef\u96a8\u610f\u63a5\u53d7\u4eba\u540d\uff0c\u547c\u53eb\u5f8c\u53ef\u5c07\u8655\u7406\u7d50\u679c\u653e\u5165\u8b8a\u6578\u4e2d\uff0c\u518d\u5c07\u6b64\u8b8a\u6578\u503c\u56de\u50b3\u3002<\/p>\n<p>                                         \u6ce8\u610f\uff1a\u81ea\u8a02\u51fd\u5f0f\u5167\u4e4b\u8b8a\u6578\u70ba\u300c\u79c1\u57df\u300d\u8b8a\u6578\uff0c\u5f71\u97ff\u7bc4\u570d\u50c5\u6b62\u65bc\u6b64\u51fd\u5f0f\u4e4b\u4e2d\u3002<br \/>\n                                       <code><br \/>\n                                         def sayHello(name):<br \/>\n                                             &nbsp;&nbsp; msg = \"Hello,\" + name<br \/>\n                                             &nbsp;&nbsp; return msg<\/p>\n<p>                                         msg =sayHello(\"John\")<br \/>\n                                         print(msg)<br \/>\n                                       <\/code>\n                                     <\/div>\n<p>                                     &nbsp;&nbsp;\n                           <\/ul>\n<li class=\"present02\">\u4e32\u5217\u8207\u6574\u6578\u4e32\u5217<\/li>\n<ul>\n<li>python \u7684\u4e32\u5217(List)\u985e\u4f3c\u65bc\u300c\u9663\u5217(Array)\u300d\u3002<\/li>\n<p>                                    \u4e32\u5217(List)\u5ba3\u544a\u65b9\u6cd5\u5c31\u8207\u4e00\u822c\u9663\u5217\u5ba3\u544a\u65b9\u6cd5\u4e00\u6a23\u3002<\/p>\n<div class=\"box01\">\n                                      \u4f8b\uff1a<br \/>\n                                         n \u70ba\u4e00\u500b\u4e32\u5217\uff0c\u5143\u7d20\u6709 1,2,3,4,5,6,7,8,9\u3002<\/p>\n<p>                                        \u5ba3\u544a n = [1,2,3,4,5,6,7,8,9] (\u6ce8\u610f\uff1a\u7d22\u5f15\u8d77\u59cb\u503c\u5f9e 0 \u958b\u59cb)<\/p>\n<ul>\n<li>n[4]= 5\uff0c\u53d6\u51fa\u7d22\u5f15\u503c\u70ba 4 \u7684\u503c <\/li>\n<li>n[1:4]= [1, 2, 3]\uff0c\u53d6\u51fa\u7d22\u5f15\u503c 1 ~ (4-1) \u7684\u503c<\/li>\n<li>n[5:8]= [5, 6, 7]\uff0c\u53d6\u51fa\u7d22\u5f15\u503c 5 ~ (8-1) \u7684\u503c<\/li>\n<li>n[0:9:2]= [0, 2, 4, 6, 8]\uff0c\u53d6\u51fa\u7d22\u5f15\u503c 0 ~ (9-1)\uff0c\u4e14\u7d22\u5f15\u503c\u9593\u9694\u6578\u70ba 2 <\/li>\n<li>n[:]= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\uff0c\u4e32\u5217\u503c\u5168\u90e8\u53d6\u51fa<\/li>\n<li>n[5:]= [5, 6, 7, 8, 9]\uff0c\u53d6\u51fa\u7d22\u5f15\u503c 5 ~ \u6700\u5f8c\u9762 \u7684\u503c<\/li>\n<li>n[-3]= [7]\uff0c\u53d6\u51fa\u7d22\u5f15\u503c \u5012\u6578 \u7b2c3 \u7684\u503c<\/li>\n<li>n[-3:]= [7, 8, 9]\uff0c\u53d6\u51fa\u7d22\u5f15\u503c \u5012\u6578 \u7b2c3 \u7684\u503c\u5230\u6700\u5f8c\u7684\u503c<\/li>\n<li>n[::-1]= [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\uff0c\u5168\u90e8\u53d6\u51fa\uff0c\u4f46\u53cd\u8f49\u5448\u73fe\u9806\u5e8f<\/li>\n<\/ul><\/div>\n<p>                                     &nbsp;&nbsp;<\/p>\n<li>\u6574\u6578\u4e32\u5217\uff0crange(\u8d77\u59cb\u503c, \u7d42\u6b62\u503c, \u9593\u9694\u503c)<\/li>\n<div class=\"box01\">\n                                      \u4f8b\uff1a<\/p>\n<ul>\n<li>list(range(8)) = [0, 1, 2, 3, 4, 5, 6, 7]\uff0c\u82e5\u50c5\u6709\u4e00\u500b\u503c\u6642\uff0c\u5247\u70ba\u300c\u7d42\u6b62\u503c\u300d<\/li>\n<li>list(range(0,10)) = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]<\/li>\n<li>list(range(2,10,2)) = [2, 4, 6, 8] <\/li>\n<\/ul><\/div>\n<p>                                    &nbsp;&nbsp;<\/p>\n<\/ul>\n<li class=\"present02\">\u8ff4\u5708(\u91dd\u5c0d list)<\/li>\n<ul>\n<li>\u5229\u7528\u8ff4\u5708\u4f9d\u5e8f\u53d6\u51fa \u4e32\u5217\u88e1\u7684\u503c<\/li>\n<div class=\"box01\">\n                                      \u4f8b\uff1a<br \/>\n                                         colors = [&#8220;red&#8221;,&#8221;green&#8221;, &#8220;blue&#8221;]<br \/>\n                                         for color in colors:<br \/>\n                                            &nbsp;&nbsp; print(color, end=&#8221;  &#8220;)\n                                     <\/div>\n<p>                                     &nbsp;&nbsp;<\/p>\n<li>\u5229\u7528\u8ff4\u5708\u4f9d\u5e8f\u53d6\u51fa \u4e32\u5217\u88e1\u7684\u503c\uff0c\u4e26\u52a0\u4ee5\u8a08\u7b97<\/li>\n<div class=\"box01\">\n                                      \u4f8b\uff1a<br \/>\n                                         nums = [1,2,3,4,5]<br \/>\n                                         total = 0<br \/>\n                                         for num in nums:<br \/>\n                                            &nbsp;&nbsp; total = total + num<\/p>\n<p>                                         print(total)\n                                     <\/p><\/div>\n<p>                                     &nbsp;&nbsp;<\/p>\n<li>\u5229\u7528 range \u751f\u51fa 1~100 \u7684list, \u4e26\u5229\u7528\u8ff4\u5708\u4f9d\u5e8f\u53d6\u51fa \u4e32\u5217\u88e1\u7684\u503c\uff0c\u4e14\u52a0\u4ee5\u8a08\u7b97<\/li>\n<div class=\"box01\">\n                                      \u4f8b\uff1a<br \/>\n                                         nums = range(1,101)<br \/>\n                                         total = 0<br \/>\n                                         for num in nums:<br \/>\n                                            &nbsp;&nbsp; total = total + num<\/p>\n<p>                                         print(total)\n                                     <\/p><\/div>\n<p>                                     &nbsp;&nbsp;<\/p>\n<\/ul>\n<\/ol>\n<\/ol>\n<hr\/>\n<h3>\u756a\u5916\u7bc7<\/h3>\n<p>\u5f71\u7247\u4f11\u606f\u6642\u9593\u6642\uff0c\u4e0d\u610f\u9593\u767c\u73fe\u300cspacedesk\u300d\u7684\u8e64\u8de1\uff0c\u539f\u4f86\u8336\u7c73\u8001\u5e2b\u662f\u5229\u7528\u300cspacedesk\u300d\u4f86\u6574\u5408\u300c\u684c\u6a5f\u300d\u548c\u300c\u5e73\u677f\u300d\u4f86\u9032\u884c\u6559\u5b78\u7684\u3002<\/p>\n<p>\u7db2\u8def\u5df2\u6709\u8a31\u591a\u6587\u7ae0\u5728\u5206\u4eab\u4f7f\u7528\u65b9\u6cd5\uff0c\u9019\u7bc7\u6587\u7ae0\u300c<a href=\"https:\/\/www.kocpc.com.tw\/archives\/262230\" rel=\"noopener\" target=\"_blank\">Spacedesk \u8b93 iOS\u3001Android \u88dd\u7f6e\u8b8a\u6210 Windows \u96fb\u8166\u7b2c\u4e8c\u87a2\u5e55\u7684\u514d\u8cbb App<\/a>\u300d\u4e5f\u6709\u7565\u4f5c\u8aaa\u660e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u4e00\u76f4\u662f\u6211\u6975\u60f3\u5b78\u7fd2\uff0c\u537b\u53c8\u4e00\u76f4\u7121\u75be\u800c\u7d42\u7684\u5931\u6557\u76ee\u6a19\uff0c\u7576\u7136\u81ea\u5df1\u7684\u7121\u6046\u6bc5\u529b\u662f\u6700 <a class=\"more-link\" href=\"https:\/\/yowlab.idv.tw\/wordpress\/?p=686\">Continue reading <span class=\"screen-reader-text\">  [\u7b46\u8a18]\u3010\u8336\u7c73\u8001\u5e2b\u6559\u5ba4\u30112022 \u6700\u65b0\u7248Python\u57fa\u790e\u5165\u9580\u8ab2\u7a0b<\/span><span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[25,26],"class_list":["post-686","post","type-post","status-publish","format-standard","hentry","category-3","category-4","tag-python","tag-26"],"_links":{"self":[{"href":"https:\/\/yowlab.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yowlab.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yowlab.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yowlab.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/yowlab.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=686"}],"version-history":[{"count":61,"href":"https:\/\/yowlab.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/686\/revisions"}],"predecessor-version":[{"id":756,"href":"https:\/\/yowlab.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/686\/revisions\/756"}],"wp:attachment":[{"href":"https:\/\/yowlab.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yowlab.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yowlab.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}