{"id":9172,"date":"2016-05-05T22:21:23","date_gmt":"2016-05-06T02:21:23","guid":{"rendered":"http:\/\/cscircles.cemc.uwaterloo.ca\/?page_id=9172"},"modified":"2017-06-28T14:12:48","modified_gmt":"2017-06-28T18:12:48","slug":"1e-zh","status":"publish","type":"page","link":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/1e-zh\/","title":{"rendered":"1E: \u9519\u8bef"},"content":{"rendered":"<!-- Please retain this notice and add more notes if you create a new version.<br \/>\nOriginal lesson author: David Pritchard, daveagp@gmail.com, http:\/\/cscircles.ca<br \/>\nLicense: http:\/\/creativecommons.org\/licenses\/by-nc-sa\/3.0\/-->\n<p>\u4f60\u4f1a\u5728\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u9047\u5230\u5f88\u591a\u9519\u8bef (\u540d\u4e3a<em>\u6f0f\u6d1e<\/em>)\u3002\u7406\u89e3\u8fd9\u4e9b\u9519\u8bef\u4ea7\u751f\u7684\u539f\u56e0\uff0c\u4ee5\u53ca\u89e3\u51b3\u65b9\u6cd5\u5728\u7f16\u7a0b\u4e2d\u5c24\u4e3a\u91cd\u8981\u3002Python\u4f1a\u4e25\u683c\u6309\u7167\u4f60\u5199\u7684\u4ee3\u7801\u8fd0\u884c\uff0c\u4f46\u5982\u679c\u5b83\u7406\u89e3\u4e0d\u4e86\u4f60\u6240\u5199\u7684\u4e1c\u897f\uff0c\u7a0b\u5e8f\u5c31\u4e0d\u4f1a\u8fd0\u884c\u3002\u540c\u6837\u7684\u9053\u7406\uff0cPython\u4f1a\u63d0\u793a\u4f60\u54ea\u4e2a\u5730\u65b9\u4f1a\u51fa\u9519\uff0c\u5e2e\u52a9\u4f60\u4fee\u6b63\u7a0b\u5e8f\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e24\u79cdPython\u9519\u8bef\u3002<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform0\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox0'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'>\u53e5\u6cd5\u9519\u8bef<\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 32px;'><textarea wrap='off' name='usercode0' id='usercode0'  cols=10 rows=1 readonly='readonly'  style = 'height : 32px;'  class='pyboxCode RO'>\nprint \"Gee golly\"<\/textarea><\/div>\n<div id='pbhistory0' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit0' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse0\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"0\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"c696bdf3fd3175e718c5ec9f1bea8f30\"\/>\n<div id='pbresults0' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit0\").value = \"Run program\";document.getElementById(\"inputInUse0\").value = \"N\";<\/script>\n<\/p>\n<p>\u5728\u7b2c\u4e00\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5fd8\u4e86\u5728 print \u540e\u9762\u7684\u5185\u5bb9\u4e0a\u52a0\u4e0a\u5706\u62ec \u53f7\uff0c\u6b63\u786e\u5f62\u5f0f\u4e3a Print (\u2026)\u3002 Python \u65e0\u6cd5\u7406\u89e3\u8fd9\u6837\u9519\u8bef\u7684\u4ee3\u7801\u3002<br \/>\n\u8fd9\u662f\u7b2c\u4e8c\u4e2a\u4f8b\u5b50\u3002<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform1\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox1'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'>\u8fd0\u884c\u65f6\u9519\u8bef<\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 32px;'><textarea wrap='off' name='usercode1' id='usercode1'  cols=10 rows=1 readonly='readonly'  style = 'height : 32px;'  class='pyboxCode RO'>\nprint(greeting)<\/textarea><\/div>\n<div id='pbhistory1' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit1' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse1\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"1\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"1f665b999084760d25a7e067230076e6\"\/>\n<div id='pbresults1' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit1\").value = \"Run program\";document.getElementById(\"inputInUse1\").value = \"N\";<\/script>\n<\/p>\n<p>\u5728\u7b2c\u4e8c\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u6ca1\u6709\u5b9a\u4e49\u00a0<code>greeting<\/code>\u00a0\u53d8\u91cf\u3002Python\u77e5\u9053\u4f60\u8981\u505a\u4ec0\u4e48\uff0c\u4f46\u662f\u56e0\u4e3a\u00a0<code>greeting<\/code>\u00a0\u6ca1\u6709\u88ab\u5b9a\u4e49\uff0c\u6240\u4ee5\u9519\u8bef\u51fa\u73b0\u4e86\u3002<\/p>\n<p>\u5f53Python\u4e0d\u7406\u89e3\u7a0b\u5e8f\u65f6\uff0c<strong>syntax error<\/strong>\u00a0\uff08\u53e5\u6cd5\u9519 \u8bef\uff09\u4f1a\u51fa\u73b0\u3002\u5f53Python\u7406\u89e3\u7a0b\u5e8f\uff0c\u4f46\u662f\u5728\u8fd0\u884c\u65f6\u51fa\u73b0\u95ee\u9898\u65f6\uff0c<strong>run-time error<\/strong>\u00a0\uff08\u8fd0\u884c\u65f6 \u9519\u8bef\uff09\u4f1a\u51fa\u73b0\u3002<\/p>\n<p>\u5728\u82f1\u8bed\u4e2d\uff0c<strong>\u53e5\u6cd5\u9519\u8bef<\/strong> \u5c31\u50cf\u662f\u8bf4<\/p>\n<p style=\"text-align: center;\"><em>Please cat dog monkey.<\/em><\/p>\n<p>\u8fd9\u53e5\u8bdd\u7684\u8bed\u6cd5\u662f\u9519\u7684\u3002\u4ece\u82f1\u8bed\u8bed\u6cd5\u89d2\u5ea6\u8bb2\uff0c\u7f3a\u5c11\u4e00\u4e2a<em>\u52a8\u8bcd<\/em>\u3002\u5bfc\u81f4\u4f60\u4e0d\u77e5\u9053\u8be5\u505a\u4ec0\u4e48\u3002<em>\u53e5\u6cd5<\/em>\u4e0e<em>\u8bed\u6cd5<\/em>\u76f8\u4f3c\u3002<\/p>\n<p>\u5728\u82f1\u8bed\u4e2d\uff0c<strong>\u8fd0\u884c\u65f6\u9519\u8bef<\/strong>\u5c31\u50cf\u662f\u8bf4<\/p>\n<p style=\"text-align: center;\"><em>Please eat the piano.<\/em><\/p>\n<p>\u8fd9\u4e2a\u53e5\u5b50\u4ece\u8bed\u6cd5\u89d2\u5ea6\u8bf4\u662f\u5bf9\u7684 \uff0d\u00a0\u6709\u52a8\u8bcd\uff0c\u6709\u540d\u8bcd\uff0c\u4f4d\u7f6e\u4e5f\u5bf9 \uff0d \u6240\u4ee5\u4f60\u80fd\u7406\u89e3\u8981\u505a\u4ec0\u4e48\u3002\u4f46\u662f\uff0c\u5728\u4f60\u6267\u884c\u5403\u94a2\u7434\u7684\u8fd9\u4e2a\u6307\u4ee4\u65f6\u4f1a\u51fa\u73b0\u95ee\u9898(\u9664\u975e\u4f60\u662f\u4e00\u53ea\u767d\u8681)\u3002\u8fd9\u4e2a\u9519\u8bef\u53eb\u505a<em>\u8fd0\u884c\u65f6\u9519\u8bef<\/em>\u56e0\u4e3a\u5b83\u5728\u8fd9\u4e2a\u7a0b\u5e8f\u8fd0\u884c\u540e\u51fa\u73b0\u3002<\/p>\n<p>\u6211\u4eec\u4f1a\u5728\u7ed3\u675f\u7684\u65f6\u5019\u8ba8\u8bba<strong>\u903b\u8f91\u9519\u8bef<\/strong>\uff0c\u903b\u8f91\u9519\u8bef\u662f\u6307\u7a0b\u5e8f\u53ef\u4ee5\u6b63\u5e38\u8fd0\u884c\uff0c\u4f46\u662f\u4f1a\u8f93\u51fa\u9519\u8bef\u7684\u7ed3\u679c\u3002\u6bd4\u5982\u8bf4\uff0c<\/p>\n<p style=\"text-align: center;\"><em>Please close the back door so that the bugs don't come in.<\/em><\/p>\n<p>\u5982\u679c<em>front door<\/em>\u662f\u6253\u5f00\u7684\uff0c\u8fd9\u5c31\u662f\u4e00\u4e2a\u903b\u8f91\u9519\u8bef\uff1a\u6f0f\u6d1e here should be \u866b\u5b50<\/p>\n<h2>\u5e38\u89c1\u7684Python\u8bed\u6cd5\u9519\u8bef<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u989d\u5916\u7684\u53e5\u6cd5\u9519\u8bef\u4f8b\u5b50\u3002\u5176\u4e2d\u4e00\u4e2a\u5f88\u5e38\u89c1\u7684\u662f\u5f53Python\u53d1\u73b0\u4e86\u4e00\u4e2a\u672c\u4e0d\u8be5\u6709\u7684\u7b26\u53f7\u3002<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform2\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox2'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'>\u8bed\u6cd5\u9519\u8bef<\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 32px;'><textarea wrap='off' name='usercode2' id='usercode2'  cols=10 rows=1 readonly='readonly'  style = 'height : 32px;'  class='pyboxCode RO'>\nprint(Hello, World!)<\/textarea><\/div>\n<div id='pbhistory2' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit2' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse2\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"2\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"8449f82ed697be1c980e4ec5a459f9c0\"\/>\n<div id='pbresults2' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit2\").value = \"Run program\";document.getElementById(\"inputInUse2\").value = \"N\";<\/script>\n<\/p>\n<p>Python\u4f1a\u663e\u793a<code>SyntaxError: invalid syntax<\/code> and points with <code>^<\/code> to the exclamation point.\u539f\u56e0\u662f <code>!<\/code>\u5728Python\u4e2d\u65e0\u610f\u4e49\u3002\u5982\u679c\u6211\u4eec\u8f93\u5165<code>print(\"Hello, World!\")<\/code>\uff0c\u7a0b\u5e8f\u5c31\u6b63\u786e\u4e86\uff0c\u56e0\u4e3a\u8fd9\u65f6Python\u5c31\u4f1a\u660e\u767d<code>!<\/code>\u662f<code>Hello, World<\/code>\u7684\u4e00\u90e8\u5206\u6587\u672c\u3002<\/p>\n<p>\u8fd9\u91cc\u8fd8\u6709\u53e6\u4e00\u4e2a\u66f4\u52a0\u4e0d\u6613\u5bdf\u89c9 \u7684\u8bed\u53e5\u9519\u8bef\u3002<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform3\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox3'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'>\u8bed\u6cd5\u9519\u8bef<\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 32px;'><textarea wrap='off' name='usercode3' id='usercode3'  cols=10 rows=1 readonly='readonly'  style = 'height : 32px;'  class='pyboxCode RO'>\nclass = \"\u5165\u95e8\u9ad8\u7ea7\u8ba1\u7b97\u673a\"<\/textarea><\/div>\n<div id='pbhistory3' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit3' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse3\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"3\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"0fcdb5e55a4ff4b88d9c4445bbc598a7\"\/>\n<div id='pbresults3' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit3\").value = \"Run program\";document.getElementById(\"inputInUse3\").value = \"N\";<\/script>\n<\/p>\n<p>\u5728Python\u4e2d\uff0c<code>class<\/code>\u662f\u4e00\u4e2a\u7279\u522b\u7684\u8bcd\u8bed\u3002\u5982\u679c\u4f60\u5199\u4e86<code>course<\/code>\u800c\u4e0d\u662fclass\u8fd8\u597d\u3002\u70b9\u51fb<a class=\"hintlink\"  id=\"hintlink4\">\u6b64\u5904<\/a>\u6765\u67e5\u770bPython\u4e2d\u6240\u6709\u7684\u7279\u6b8a\u201c\u5173\u952e\u8bcd\u201d\u3002<\/p>\n<p>\u5982\u679c\u4f60\u5728\u6587\u672c\u4e24\u8fb9\u53ea\u52a0\u4e86\u4e00\u4e2a\u53cc\u5f15\u53f7\uff0c\u6216\u8005\u53ea\u7528\u4e86\u4e00\u4e2a\u5355\u62ec\u53f7\uff0c\u4f60\u4f1a\u5f97\u5230\u4ee5\u4e0b\u53e5\u6cd5\u9519\u8bef\uff1a<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform5\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox5'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'>\u53e5\u6cd5\u9519\u8bef<\/span><\/div>\u7f3a\u5c11\u7b2c\u4e8c\u4e2a\u53cc\u5f15\u53f7<div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 32px;'><textarea wrap='off' name='usercode5' id='usercode5'  cols=10 rows=1 readonly='readonly'  style = 'height : 32px;'  class='pyboxCode RO'>\nname = \"Jim<\/textarea><\/div>\n<div id='pbhistory5' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit5' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse5\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"5\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"18f77317d1a1c9b772d00377ac539eea\"\/>\n<div id='pbresults5' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit5\").value = \"Run program\";document.getElementById(\"inputInUse5\").value = \"N\";<\/script>\n<\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u91cc\uff0c<strong>EOL<\/strong>\u662f<strong>E<\/strong>nd <strong>O<\/strong>f <strong>L<\/strong>ine\u7684\u7f29\u5199\uff1aPython\u9700\u8981\u53e6\u4e00\u4e2a<code>\"<\/code>\u4f46\u662f\u8fd9\u4e00\u884c\u5185\u6ca1\u6709\u3002<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform6\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox6'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'>\u53e5\u6cd5\u9519\u8bef<\/span><\/div>\u7f3a\u5c11\u7b2c\u4e8c\u4e2a\u62ec\u53f7<div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 32px;'><textarea wrap='off' name='usercode6' id='usercode6'  cols=10 rows=1 readonly='readonly'  style = 'height : 32px;'  class='pyboxCode RO'>\nprint(77<\/textarea><\/div>\n<div id='pbhistory6' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit6' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse6\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"6\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"a4415418904acc3d5d944273f55df2bc\"\/>\n<div id='pbresults6' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit6\").value = \"Run program\";document.getElementById(\"inputInUse6\").value = \"N\";<\/script>\n<\/p>\n<p>\u540c\u6837\uff0c<strong>EOF<\/strong>\u662f<strong>E<\/strong>nd\u00a0<strong>O<\/strong>f\u00a0<strong>F<\/strong>ile\u7684\u7f29\u5199\uff1aPython\u9700\u8981<code>)<\/code>\u4f46\u662f\u7a0b\u5e8f\u5185\u6ca1\u6709\u3002<\/p>\n<p>\u6709\u65f6\u770b\u4f3c\u76f8\u8fd1\u7684\u4e24\u4e2a\u53e5\u6cd5\u9519\u8bef\u5176\u5b9e\u4f1a\u6709\u4e0d\u540c\u7684\u9519\u8bef\u63d0\u793a\u3002\u4f46\u4e0d\u7ba1\u600e\u6837\uff0c\u9519\u8bef\u63d0\u793a\u90fd\u662f\u4e3a\u4e86\u5e2e\u52a9\u4f60\u6539\u6b63\u4ee3\u7801\u3002<\/p>\n<h2>\u8fd0\u884c\u65f6\u9519\u8bef<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u8fd0\u884c\u65f6\u9519\u8bef\u3002Python\u80fd\u7406\u89e3\u7a0b\u5e8f\u6307\u4ee4\uff0c\u4f46\u662f\u8fd0\u884c\u65f6\u51fa\u4e86\u95ee\u9898\u3002<\/p>\n<ul>\n<li>\u4f7f\u7528\u672a\u5b9a\u4e49\u7684\u53d8\u91cf\u6216\u65b9\u7a0b\u3002\u5982\u679c\u968f\u610f\u7be1\u6539\u5927\u5c0f\u5199\uff0c\u8fd9\u79cd\u9519\u8bef\u5c31\u4f1a\u53d1\u751f\uff1a<form class=\"pbform\" action=\"#\" id=\"pbform7\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox7'>\n<div class=\"heading\"><span class=\"title\">Example<\/span><\/div>\u672a\u5b9a\u4e49\u53d8\u91cf<div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 58px;'><textarea wrap='off' name='usercode7' id='usercode7'  cols=10 rows=2 readonly='readonly'  style = 'height : 58px;'  class='pyboxCode RO'>\ncallMe = \"Maybe\"\nprint(callme)<\/textarea><\/div>\n<div id='pbhistory7' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit7' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse7\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"7\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"4f31cdc433eda08b09f9520f4297481d\"\/>\n<div id='pbresults7' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit7\").value = \"Run program\";document.getElementById(\"inputInUse7\").value = \"N\";<\/script>\n<\/li>\n<li>\u9664\u4ee50\u3002\u6570\u5b66\u89d2\u5ea6\u4e0a\u662f\u9519\u8bef\u7684\u3002\uff08\u4e3a\u4ec0\u4e48\uff1f\u56e0\u4e3a0\u4e58\u4efb\u4f55\u6570\u90fd\u662f0\uff0c\u6240\u4ee5 1 = <em>X<\/em>\u00a0* 0\u65e0\u89e3\uff0c\u6240\u4ee5 1\/0 \u65e0\u610f\u4e49) <form class=\"pbform\" action=\"#\" id=\"pbform8\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox8'>\n<div class=\"heading\"><span class=\"title\">Example<\/span><\/div>\u9664\u4ee50<div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 32px;'><textarea wrap='off' name='usercode8' id='usercode8'  cols=10 rows=1 readonly='readonly'  style = 'height : 32px;'  class='pyboxCode RO'>\nprint(1\/0)<\/textarea><\/div>\n<div id='pbhistory8' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit8' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse8\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"8\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"09f9746176a2d4230f0c6fff91c10e14\"\/>\n<div id='pbresults8' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit8\").value = \"Run program\";document.getElementById(\"inputInUse8\").value = \"N\";<\/script>\n<\/li>\n<li>\u4ee3\u7801\u7c7b\u522b\u4e0d\u7b26<form class=\"pbform\" action=\"#\" id=\"pbform9\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox9'>\n<div class=\"heading\"><span class=\"title\">Example<\/span><\/div>\u5c06\u6570\u5b57\u4e0e\u5b57\u6bcd\u76f8\u52a0<div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 32px;'><textarea wrap='off' name='usercode9' id='usercode9'  cols=10 rows=1 readonly='readonly'  style = 'height : 32px;'  class='pyboxCode RO'>\nprint(\"you cannot add text and numbers\" + 12)<\/textarea><\/div>\n<div id='pbhistory9' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit9' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse9\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"9\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"751a7ab390bfdd3c27346bc7449b2b2f\"\/>\n<div id='pbresults9' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit9\").value = \"Run program\";document.getElementById(\"inputInUse9\").value = \"N\";<\/script>\n<\/li>\n<\/ul>\n<p>\u968f\u7740\u6211\u4eec\u5b66\u4e60\u7684\u6df1\u5165\uff0c\u4f1a\u6709\u66f4\u591a\u7684Python\u53e5\u6cd5\u9519\u8bef\u3002<\/p>\n<p><table class='pywarn'><tr><td class='pywarnleft'><img src='https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-content\/plugins\/pybox\/files\/warning.png'\/><\/td><td class='pywarnright'><span> \u4ece\u6280\u672f\u89d2\u5ea6\u6765\u770b\uff0c\u53e5\u6cd5\u9519\u8bef\u548c\u8fd0\u884c\u65f6\u9519\u8bef\u6709\u4ec0\u4e48\u533a\u522b\u5462\uff1f\u4e0b\u9762\u6211\u4eec\u4e00\u8d77\u6765\u6bd4\u8f83\u4e00\u4e0b\u4ed6\u4eec\u3002\u89c2\u5bdf\u6bcf\u4e2a\u7a0b\u5e8f\u7684\u8f93\u51fa\u3002<form class=\"pbform\" action=\"#\" id=\"pbform10\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox10'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'>\u8fd0\u884c\u65f6\u9519\u8bef<\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 58px;'><textarea wrap='off' name='usercode10' id='usercode10'  cols=10 rows=2 readonly='readonly'  style = 'height : 58px;'  class='pyboxCode RO'>\nprint(\"\u8fd9\u662f\u4e00\u4e9b\u6587\u5b57\")\nprint(1\/0)<\/textarea><\/div>\n<div id='pbhistory10' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit10' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse10\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"10\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"72125f3201b5cbf8384f0cf25059dd98\"\/>\n<div id='pbresults10' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit10\").value = \"Run program\";document.getElementById(\"inputInUse10\").value = \"N\";<\/script>\n <form class=\"pbform\" action=\"#\" id=\"pbform11\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox11'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'>\u53e5\u6cd5\u9519\u8bef<\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 58px;'><textarea wrap='off' name='usercode11' id='usercode11'  cols=10 rows=2 readonly='readonly'  style = 'height : 58px;'  class='pyboxCode RO'>\nprint(\"\u8fd9\u662f\u4e00\u4e9b\u6587\u5b57\")\nprint(1*0<\/textarea><\/div>\n<div id='pbhistory11' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit11' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse11\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"11\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"0c3b2768381e968de525fbe1c042048a\"\/>\n<div id='pbresults11' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit11\").value = \"Run program\";document.getElementById(\"inputInUse11\").value = \"N\";<\/script>\n\u4f1a\u51fa\u73b0\u8fd0\u884c\u65f6\u9519\u8bef\u7684\u7a0b\u5e8f\u4f1a\u6709\u8f93\u51fa\uff0c\u800c\u51fa\u73b0\u53e5\u6cd5\u9519\u8bef\u7684\u7a0b\u5e8f\u4e0d\u4f1a\u8f93\u51fa\u3002\u8fd9\u662f\u56e0\u4e3aPython\u8fd0\u884c\u662f\u5206\u4e24\u6b65\u8d70\u7684\uff1a <\/p>\n<ol>  \t<\/p>\n<li>Python\u9996\u5148\u67e5\u770b\u7a0b\u5e8f\u53e5\u6cd5\u662f\u5426\u6b63\u786e\uff0c\u4ee5\u786e\u5b9a\u5176\u7ec4\u6210\u6210\u5206\u3002<\/li>\n<p>  \t<\/p>\n<li>\u5982\u679c\u53e5\u6cd5\u6b63\u786e\uff0c\u7a0b\u5e8f\u624d\u4f1a\u88ab\u8fd0\u884c\u3002<\/li>\n<p> <\/ol>\n<p> <\/p>\n<div>\u6240\u4ee5\uff0c\u4e00\u4e2a\u53e5\u6cd5\u9519\u8bef\u7684\u7a0b\u5e8f\u6839\u672c\u4e0d\u4f1a\u8fd0\u884c\uff0c\u4f46\u662f\u4e00\u4e2a\u8fd0\u884c\u65f6\u9519\u8bef\u7684\u7a0b\u5e8f\u4f1a\u8fd0\u884c\uff0c\u76f4\u5230\u9519\u8bef\u51fa\u73b0\u3002<\/div>\n<p>  <\/span><\/td><\/table><\/p>\n<h2>\u903b\u8f91\u9519\u8bef<\/h2>\n<p>\u7a0b\u5e8f\u4e5f\u53ef\u4ee5\u6210\u529f\u8fd0\u884c(\u4e0d\u51fa\u73b0\u53e5\u6cd5\u6216\u8fd0\u884c\u65f6\u9519\u8bef)\u4f46\u662f\u505a\u7684\u4e8b\u60c5\u53ef\u80fd\u4e0d\u5bf9\u3002\u6bd4\u5982\uff0c\u4f60\u53ef\u80fd\u60f3\u8981\u4e00\u4e2a\u53ef\u4ee5\u8ba1\u7b97\u4e24\u4e2a\u6570<em>\u5e73\u5747\u503c<\/em>\u7684\u7a0b\u5e8f\uff1a<em>x<\/em>\u548c<em>y<\/em>\u7684\u5e73\u5747\u503c\u7684\u5b9a\u4e49\u4e3a<\/p>\n<p style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%5Cdisplaystyle%7B%5Cfrac%7Bx%2By%7D%7B2%7D%7D&#038;bg=T&#038;fg=000000&#038;s=2' alt='\\displaystyle{\\frac{x+y}{2}}' title='\\displaystyle{\\frac{x+y}{2}}' class='latex' \/><\/p>\n<p>\u4e3a\u4ec0\u4e48\u8fd9\u4e2a\u7a0b\u5e8f\u4e0d\u5bf9\u5462?<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform12\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox12'>\n<div class=\"heading\"><span class=\"title\">Example<\/span><\/div>This does <em>not <\/em>calculate the average correctly.<div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 110px;'><textarea wrap='off' name='usercode12' id='usercode12'  cols=10 rows=4 readonly='readonly'  style = 'height : 110px;'  class='pyboxCode RO'>\nx = 3\ny = 4\naverage = x + y \/ 2\nprint(average)<\/textarea><\/div>\n<div id='pbhistory12' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit12' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse12\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"12\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"2495b74069089ef3bf1c45449394ab3d\"\/>\n<div id='pbresults12' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit12\").value = \"Run program\";document.getElementById(\"inputInUse12\").value = \"N\";<\/script>\n<\/p>\n<p>\u5e73\u5747\u503c\u5e94\u8be5\u662f<\/p>\n<p style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%5Cdisplaystyle%7B%5Cfrac%7Bx%2By%7D%7B2%7D%3D%5Cfrac%7B3%2B4%7D%7B2%7D%3D%5Cfrac%7B7%7D%7B2%7D%3D3.5%7D&#038;bg=T&#038;fg=000000&#038;s=2' alt='\\displaystyle{\\frac{x+y}{2}=\\frac{3+4}{2}=\\frac{7}{2}=3.5}' title='\\displaystyle{\\frac{x+y}{2}=\\frac{3+4}{2}=\\frac{7}{2}=3.5}' class='latex' \/><\/p>\n<p>\u4f46\u662f\u7a0b\u5e8f\u8fd0\u884c\u7ed3\u679c\u662f<code>5.0<\/code>\uff01\u8fd9\u6b21\u9519\u8bef\u662f\u5173\u4e8e\u7b97\u6570\u4e2d\u201c\u8fd0\u884c\u987a\u5e8f\u201d\u7684\u95ee\u9898\u3002\u5f53\u4f60\u8f93\u5165<code>x + y \/ 2<\/code>\u7684\u65f6\u5019\uff0c\u4ece\u6570\u5b66\u7684\u89d2\u5ea6\u4e0a\u8bb2\u7b49\u540c\u4e8e<img src='https:\/\/s0.wp.com\/latex.php?latex=x+%2B+%28y+%2F+2%29+%3D+3+%2B+%284+%2F+2%29+%3D+3+%2B+2+%3D+5&#038;bg=T&#038;fg=000000&#038;s=2' alt='x + (y \/ 2) = 3 + (4 \/ 2) = 3 + 2 = 5' title='x + (y \/ 2) = 3 + (4 \/ 2) = 3 + 2 = 5' class='latex' \/>\u3002\u4fee\u6b63\u8fd9\u4e2a\u4e1c\u897f\uff0c\u7b2c\u4e09\u884c\u7a0b\u5e8f\u5e94\u8be5\u88ab\u5199\u6210<code>average = (x + y) \/ 2<\/code>\uff0c\u4ee5\u544a\u8bc9Python\u6211\u4eec\u771f\u6b63\u60f3\u8981\u7684\u662f<img src='https:\/\/s0.wp.com\/latex.php?latex=%5Cfrac%7Bx%2By%7D%7B2%7D&#038;bg=T&#038;fg=000000&#038;s=3' alt='\\frac{x+y}{2}' title='\\frac{x+y}{2}' class='latex' \/>\uff0c\u5148\u8fdb\u884c\u52a0\u6cd5\uff0c\u5728\u8fdb\u884c\u9664\u6cd5\u3002<br \/>\n\u903b\u8f91\u9519\u8bef\u51fa\u73b0\u7684\u539f\u56e0\u662f\u9519\u8bef\u5730<em>\u8bbe\u8ba1<\/em>\u4e86\u7a0b\u5e8f\uff0c\u6216\u8005\u662f\u56e0\u4e3a\u5199\u7684\u4ee3\u7801\u8868\u8fbe\u7684\u610f\u601d\u4e0e\u8bbe\u8ba1\u672c\u610f\u4e0d\u7b26(\u6bd4\u5982<code>\u5e73\u5747\u503c<\/code>\u8fd9\u4e2a\u4f8b\u5b50)\u3002\u903b\u8f91\u9519\u8bef\u5f88\u96be\u88ab\u53d1\u73b0\uff0c\u5c24\u5176\u662f\u5728\u4e00\u4e2a\u5f88\u957f\u7684\u7a0b\u5e8f\u4e2d\uff0c\u4f46\u968f\u7740\u4f60\u7f16\u7a0b\u7ecf\u9a8c\u7684\u7d2f\u8ba1\uff0c\u4f60\u4f1a\u66f4\u64c5\u957f\u907f\u5f00\u8fd9\u4e9b\u903b\u8f91\u9519\u8bef\u3002\u7b2c6D\u8bfe\u4f1a\u7ed9\u4e00\u4e9b\u5e2e\u52a9\u4f60\u89c4\u907f\u8fd9\u4e9b\u903b\u8f91\u9519\u8bef\u7684\u5efa\u8bae\u3002<\/p>\n<h2>\u7ec3\u4e60<\/h2>\n<p>\u5230\u6b64\u4e3a\u6b62\u8fd9\u4e00\u8282\u8bfe\u7684\u77e5\u8bc6\u5c31\u8bb2\u89e3\u5b8c\u4e86\uff0c\u4e0b\u9762\u662f\u4e00\u4e9b\u6709\u5173<em>\u8c03\u8bd5<\/em>\u7684\u7ec3\u4e60\u9898(\u4fee\u6b63\u7a0b\u5e8f\u4e2d\u7684\u6f0f\u6d1e)\u3002\u4f60\u53ef\u4ee5\u8bd5\u7740\u5728\u7a0b\u5e8f\u8fd0\u884c\u524d\u67e5\u627e \u5e76\u4fee\u6b63\u9519\u8bef\uff0c\u6216\u8005\u5148\u8fd0\u884c\u7a0b\u5e8f \u7136\u540e\u901a\u8fc7\u7a0b\u5e8f\u63d0\u793a\u6765\u8fdb\u884c\u4fee\u6b63\u3002<\/p>\n<p><table class='pywarn'><tr><td class='pywarnleft'><img src='https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-content\/plugins\/pybox\/files\/warning.png'\/><\/td><td class='pywarnright'><span> \u6bcf\u4e00\u4e2a\u7a0b\u5e8f\u90fd\u662f\u5df2\u7ecf\u5199\u597d\u7684\u4ee3\u7801\u3002\u4f60\u53ea\u9700\u8981\u6539\u51e0\u4e2a\u5b57\u7b26(\u5b57\u6bcd\/\u7b26\u53f7\/\u6570\u5b57)\u6765\u4fee\u6b63\u6bcf\u4e2a\u7a0b\u5e8f\u3002<em>\u7cfb\u7edf\u62d2\u7edd\u8bc4\u5224\u66f4\u6539\u592a\u591a\u5b57\u7b26\u7684\u7a0b\u5e8f<\/em>\u3002\u5982\u679c\u60f3\u8981\u5c06\u7a0b\u5e8f\u81f3\u539f\u59cb\u7a0b\u5e8f\uff0c\u70b9\u51fb<strong>\u91cd\u7f6e\u7a0b\u5e8f<\/strong>\u3002 <\/span><\/td><\/table><\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform13\" method=\"POST\">\n<div class='pybox modeNeutral ' id='pybox13'>\n<img title='You have not yet completed this problem.' src='https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-content\/plugins\/pybox\/files\/icon.png' class='pycheck'\/><div class=\"heading\"><span class='type'>Coding Exercise: <\/span><span class='title'>\u590f\u5929<\/span><\/div>\u8bf7\u4fee\u6539\u4ee5\u4e0b\u7a0b\u5e8f\u7684\u53e5\u6cd5\u9519\u8bef\uff0c\u4f7f\u5f97\u6253\u5370\u51fa\u4ece1\u523010\u7684\u548c\u3002\u81f3\u591a\u53ef\u6539\u4e00\u4e2a\u5b57\u7b26\u3002<div class=\"helpOuter\" style=\"display: none;\"><div class=\"helpInner\"><div style=\"text-align: center\">You need to create an account and log in to ask a question.<\/div><\/div><\/div><div class='pyboxTextwrap pyboxCodewrap RW resizy'  style='height: 526px;'><textarea wrap='off' name='usercode13' id='usercode13'  cols=10 rows=20   class='pyboxCode RW'>\nprint(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 +)\n<\/textarea><\/div>\n<div id='pbhistory13' class='flexcontain' style='display:none;'><\/div>\n<input type='hidden' id='defaultCode13' value='print(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 +)\\n'><\/input>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit13' value=' '\/><\/td>\n<td><input type='button' name='history' value=\"History\" onclick=\"historyClick(13,'1e.product')\" ><\/td>\n<td><input type='button' name='default' value=\"Reset code to default\" onclick=\"pbSetText(13,descape($('#defaultCode13').val()))\" ><\/td>\n<td><input type='button' name='help' value=\"Help\" onclick=\"helpClick(13);\" ><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse13\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"13\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"2d73196f7f1eda1d413689962d89b4d1\"\/>\n<div id='pbresults13' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit13\").value = \"Run program\";document.getElementById(\"inputInUse13\").value = \"N\";<\/script>\n<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform14\" method=\"POST\">\n<div class='pybox modeNeutral ' id='pybox14'>\n<img title='You have not yet completed this problem.' src='https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-content\/plugins\/pybox\/files\/icon.png' class='pycheck'\/><div class=\"heading\"><span class='type'>Coding Exercise: <\/span><span class='title'>\u4f60\u597d Joe<\/span><\/div>\u8bf7\u4fee\u6539\u4ee5\u4e0b\u7a0b\u5e8f\u4e2d\u5b58\u5728\u7684\u8fd0\u884c\u65f6\u9519\u8bef\uff0c\u4f7f\u5f97\u5728\u7b2c\u4e00\u884c\u6253\u5370<code>Hello<\/code>\uff0c\u5728\u7b2c\u4e8c\u884c\u6253\u5370<code>Joe<\/code>\u3002\u81f3\u591a\u53ef\u6539\u4e24\u4e2a\u5b57\u7b26\u3002<div class=\"helpOuter\" style=\"display: none;\"><div class=\"helpInner\"><div style=\"text-align: center\">You need to create an account and log in to ask a question.<\/div><\/div><\/div><div class='pyboxTextwrap pyboxCodewrap RW resizy'  style='height: 526px;'><textarea wrap='off' name='usercode14' id='usercode14'  cols=10 rows=20   class='pyboxCode RW'>\nprint(\"Hello\")\nusername = Joe \nprint(username)\n<\/textarea><\/div>\n<div id='pbhistory14' class='flexcontain' style='display:none;'><\/div>\n<input type='hidden' id='defaultCode14' value='print(\\\"Hello\\\")\\nusername = Joe \\nprint(username)\\n'><\/input>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit14' value=' '\/><\/td>\n<td><input type='button' name='history' value=\"History\" onclick=\"historyClick(14,'1e.joe')\" ><\/td>\n<td><input type='button' name='default' value=\"Reset code to default\" onclick=\"pbSetText(14,descape($('#defaultCode14').val()))\" ><\/td>\n<td><input type='button' name='help' value=\"Help\" onclick=\"helpClick(14);\" ><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse14\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"14\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"002d444b3df1782835767616503dabe7\"\/>\n<div id='pbresults14' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit14\").value = \"Run program\";document.getElementById(\"inputInUse14\").value = \"N\";<\/script>\n<\/p>\n<p><!--\u6700\u540e\u4e00\u4e2a\u95ee\u9898\u6bd4\u524d\u4e24\u4e2a\u96be\u3002 \u5982\u679c\u6ca1\u505a\u51fa\u6765\uff0c\u53ef\u4ee5\u76f4\u63a5\u8fdb\u884c\u4e0b\u4e00\u8bfe\u7684\u5b66\u4e60\u3002\u4f60\u53ef\u4ee5\u968f\u65f6\u67e5\u770b\u54ea\u4e9b\u7ec3\u4e60\u4f60\u5b8c\u6210\u4e86\uff0c\u54ea\u4e9b\u4f60\u8df3\u8fc7\u4e86\u3002<a title=\"\u6211\u7684\u8fdb\u5c55\" href=\"\/user-page\/\">My Progress<\/a> page.--><\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform15\" method=\"POST\">\n<div class='pybox modeNeutral ' id='pybox15'>\n<img title='You have not yet completed this problem.' src='https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-content\/plugins\/pybox\/files\/icon.png' class='pycheck'\/><div class=\"heading\"><span class='type'>Coding Exercise: <\/span><span class='title'>\u8d2d\u7269<\/span><\/div>\u4f60\u6253\u7b97\u53bb\u4e70\u8089\u548c\u725b\u5976\uff0c\u4f46\u662f\u9700\u8981\u4ea4\u7a0e\u3002\u4f60\u4e70\u4e862\u7f8e\u91d1\u7684\u725b\u5976\u548c4\u7f8e\u91d1\u7684\u8089\uff0c\u7a0e\u7387\u4e3a3%\u3002\u6253\u5370\u51fa\u603b\u989d(\u4e0d\u9700\u8981\u6253\u5370\u51fa$)\u3002<a class=\"hintlink\"  id=\"hintlink16\">Hint<\/a><div class=\"helpOuter\" style=\"display: none;\"><div class=\"helpInner\"><div style=\"text-align: center\">You need to create an account and log in to ask a question.<\/div><\/div><\/div><div class='pyboxTextwrap pyboxCodewrap RW resizy'  style='height: 526px;'><textarea wrap='off' name='usercode15' id='usercode15'  cols=10 rows=20   class='pyboxCode RW'>\nmeatPrice = 4.00\nmeatTax = 0.03 * meatPrice\nmilkPrice = 2.00\nmilkTax = 0.03 * milkPrice\nprint(meatTax + meatPrice + milkTax + meatPrice)\n<\/textarea><\/div>\n<div id='pbhistory15' class='flexcontain' style='display:none;'><\/div>\n<input type='hidden' id='defaultCode15' value='meatPrice = 4.00\\nmeatTax = 0.03 * meatPrice\\nmilkPrice = 2.00\\nmilkTax = 0.03 * milkPrice\\nprint(meatTax + meatPrice + milkTax + meatPrice)\\n'><\/input>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit15' value=' '\/><\/td>\n<td><input type='button' name='history' value=\"History\" onclick=\"historyClick(15,'1e.shopping')\" ><\/td>\n<td><input type='button' name='default' value=\"Reset code to default\" onclick=\"pbSetText(15,descape($('#defaultCode15').val()))\" ><\/td>\n<td><input type='button' name='help' value=\"Help\" onclick=\"helpClick(15);\" ><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse15\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"15\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"7d5f2f1b0d1914cdae962ea32f36101c\"\/>\n<div id='pbresults15' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit15\").value = \"Run program\";document.getElementById(\"inputInUse15\").value = \"N\";<\/script>\n<\/p>\n<p>\u5f53\u4f60\u5b8c\u6210\u4ee5\u4e0a\u7ec3\u4e60\u9898\u540e\uff0c\u8fdb\u5165\u4e0b\u4e00\u8bfe\u7684\u5b66\u4e60\u5427!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f60\u4f1a\u5728\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u9047\u5230\u5f88\u591a\u9519\u8bef (\u540d\u4e3a\u6f0f\u6d1e)\u3002\u7406\u89e3\u8fd9\u4e9b\u9519\u8bef\u4ea7\u751f\u7684\u539f\u56e0\uff0c\u4ee5\u53ca\u89e3\u51b3\u65b9\u6cd5\u5728\u7f16\u7a0b\u4e2d\u5c24\u4e3a\u91cd\u8981\u3002Python\u4f1a\u4e25\u683c\u6309\u7167\u4f60\u5199\u7684\u4ee3\u7801\u8fd0\u884c\uff0c\u4f46\u5982\u679c\u5b83\u7406\u89e3\u4e0d\u4e86\u4f60\u6240\u5199\u7684\u4e1c\u897f\uff0c\u7a0b\u5e8f\u5c31\u4e0d\u4f1a\u8fd0\u884c\u3002\u540c\u6837\u7684\u9053\u7406\uff0cPython\u4f1a\u63d0\u793a\u4f60\u54ea\u4e2a\u5730\u65b9\u4f1a\u51fa\u9519\uff0c\u5e2e\u52a9\u4f60\u4fee\u6b63\u7a0b\u5e8f\u3002 \u4ee5\u4e0b\u662f\u4e24\u79cdPython\u9519\u8bef\u3002 Example: \u53e5\u6cd5\u9519\u8bef print \"Gee golly\" \u5728\u7b2c\u4e00\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5fd8\u4e86\u5728 print \u540e\u9762\u7684\u5185\u5bb9\u4e0a\u52a0\u4e0a\u5706\u62ec \u53f7\uff0c\u6b63\u786e\u5f62\u5f0f\u4e3a Print (\u2026)\u3002 Python \u65e0\u6cd5\u7406\u89e3\u8fd9\u6837\u9519\u8bef\u7684\u4ee3\u7801\u3002 \u8fd9\u662f\u7b2c\u4e8c\u4e2a\u4f8b\u5b50\u3002 Example: \u8fd0\u884c\u65f6\u9519\u8bef print(greeting) \u5728\u7b2c\u4e8c\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u6ca1\u6709\u5b9a\u4e49\u00a0greeting\u00a0\u53d8\u91cf\u3002Python\u77e5\u9053\u4f60\u8981\u505a\u4ec0\u4e48\uff0c\u4f46\u662f\u56e0\u4e3a\u00a0greeting\u00a0\u6ca1\u6709\u88ab\u5b9a\u4e49\uff0c\u6240\u4ee5\u9519\u8bef\u51fa\u73b0\u4e86\u3002 \u5f53Python\u4e0d\u7406\u89e3\u7a0b\u5e8f\u65f6\uff0csyntax error\u00a0\uff08\u53e5\u6cd5\u9519 \u8bef\uff09\u4f1a\u51fa\u73b0\u3002\u5f53Python\u7406\u89e3\u7a0b\u5e8f\uff0c\u4f46\u662f\u5728\u8fd0\u884c\u65f6\u51fa\u73b0\u95ee\u9898\u65f6\uff0crun-time error\u00a0\uff08\u8fd0\u884c\u65f6 \u9519\u8bef\uff09\u4f1a\u51fa\u73b0\u3002 \u5728\u82f1\u8bed\u4e2d\uff0c\u53e5\u6cd5\u9519\u8bef \u5c31\u50cf\u662f\u8bf4 Please cat dog monkey. \u8fd9\u53e5\u8bdd\u7684\u8bed\u6cd5\u662f\u9519\u7684\u3002\u4ece\u82f1\u8bed\u8bed\u6cd5\u89d2\u5ea6\u8bb2\uff0c\u7f3a\u5c11\u4e00\u4e2a\u52a8\u8bcd\u3002\u5bfc\u81f4\u4f60\u4e0d\u77e5\u9053\u8be5\u505a\u4ec0\u4e48\u3002\u53e5\u6cd5\u4e0e\u8bed\u6cd5\u76f8\u4f3c\u3002 \u5728\u82f1\u8bed\u4e2d\uff0c\u8fd0\u884c\u65f6\u9519\u8bef\u5c31\u50cf\u662f\u8bf4 Please eat the piano. \u8fd9\u4e2a\u53e5\u5b50\u4ece\u8bed\u6cd5\u89d2\u5ea6\u8bf4\u662f\u5bf9\u7684 \uff0d\u00a0\u6709\u52a8\u8bcd\uff0c\u6709\u540d\u8bcd\uff0c\u4f4d\u7f6e\u4e5f\u5bf9 &hellip; <a href=\"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/1e-zh\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-9172","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/pages\/9172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/comments?post=9172"}],"version-history":[{"count":17,"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/pages\/9172\/revisions"}],"predecessor-version":[{"id":10197,"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/pages\/9172\/revisions\/10197"}],"wp:attachment":[{"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/media?parent=9172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}