{"id":9490,"date":"2016-08-16T02:20:15","date_gmt":"2016-08-16T06:20:15","guid":{"rendered":"http:\/\/cscircles.cemc.uwaterloo.ca\/?page_id=9490"},"modified":"2016-08-17T15:53:06","modified_gmt":"2016-08-17T19:53:06","slug":"run-at-home-zh","status":"publish","type":"page","link":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/run-at-home-zh\/","title":{"rendered":"\u5728\u5bb6\u91cc\u8fd0\u884c\u7a0b\u5e8f"},"content":{"rendered":"<p>\u4f60\u5728CS Circles\u63d0\u4ea4\u7684\u4ee3\u7801\u662f\u901a\u8fc7<em>Python<\/em>\u7684\u590d\u5236\u54c1\u5728\u7f51\u7ad9\u670d\u52a1\u5668\u8fd0\u884c\uff0c\u53ef\u4ee5\u8ba9\u6211\u4eec\u81ea\u52a8\u8bc4\u5224\u3002\u7136\u800c\uff0c\u66f4\u4f20\u7edf\u7684\u7f16\u7a0b\u65b9\u5f0f\u662f\u4f60\u5728\u7535\u8111\u4e0a\u4e0b\u8f7d\u4e00\u4e2aPython\u7ffb\u8bd1\u5668\u3002\u5728\u81ea\u5df1\u5bb6\u91cc\u8fd0\u884cPython\u6709\u51e0\u4e2a\u989d\u5916\u597d\u5904\uff1a(i)\u4f60\u4e0d\u53d7\u9650\u4e8e\u5728\u6211\u4eec\u7684\u7f51\u7ad9\u670d\u52a1\u5668\u4e0a\u5206\u4eab\u6709\u9650\u7684\u8d44\u6e90\uff1b(ii)\u4f60\u53ef\u4ee5\u7f16\u5199\u4ea4\u4e92\u5f0f\u7a0b\u5e8f(\u89c1\u4e0b\u6587)\uff1b(iii)\u8f6f\u4ef6\u88ab\u4e0b\u8f7d\u540e\uff0c\u4f60\u4e0d\u9700\u8981\u8054\u7f51\u518d\u8fd0\u884c\u7a0b\u5e8f; (iv)\u4f60\u53ef\u4ee5\u4f7f\u7528\u8c03\u8bd5\u5de5\u5177\uff0c\u58f0\u97f3\uff0c\u548c\u5236\u56fe\u5b66\u3002<\/p>\n<h2><span style=\"color: #000000;\"><strong>\u514d\u8d39\u7684Python\u5de5\u5177<\/strong><\/span><\/h2>\n<p>\u4e0d\u8bba\u662fWindows\uff0cMac\uff0c\u8fd8\u662fLinux\uff0c\u4e3a\u4e86\u8ba9Python\u5728\u81ea\u5df1\u7684\u7535\u8111\u4e0a\u8fd0\u884c\uff0c\u4f60\u53ef\u4ee5\u5728Python.org\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u3002<a href=\"https:\/\/www.python.org\/downloads\/\">\u70b9\u51fb\u8fd9\u91cc\u6765\u767b\u9646Python\u4e0b\u8f7d\u9875\u9762<\/a>\u3002\u9009\u62e9\u6700\u65b0\u76843.x\u7248\u672c\uff0c\u9009\u62e9\u5339\u914d\u4f60\u7684\u7535\u8111\u673a\u578b\u7684\u4e0b\u8f7d\u5668(\u6bd4\u5982\uff0c\u5bf9\u4e8e32-bit\u7684Windows\u7cfb\u7edf\uff0c\u9009\u62e9\"Windows x86 MSI Installer\")\uff0c\u7136\u540e\u4e0b\u8f7d\u5e76\u8fd0\u884c\u4e0b\u8f7d\u5668\u3002\u4e0b\u8f7d\u540e\uff0c\u8fd0\u884c\u540d\u4e3a<strong>IDLE<\/strong>\u7684\u7a0b\u5e8f\u4f1a\u6253\u5f00\u4e00\u4e2a\u4ea4\u4e92\u6027Python\u63d0\u793a\u3002<\/p>\n<p>\u63d0\u793a\uff1a\u5982\u679c\u4f60\u4f7f\u7528\u5b66\u6821\u7684\u7535\u8111\uff0c\u4f60\u6216\u8bb8\u4e0d\u80fd\u5b8c\u6210\u4e0b\u8f7d\uff0c\u56e0\u4e3a\u4f1a\u6709\u6743\u9650\u7684\u95ee\u9898\uff1b\u6216\u8bb8\u9700\u8981\u5f97\u5230\u6743\u9650\uff0c\u9700\u8981\u7f51\u7edc\u7ba1\u7406\u5458\u3002\u867d\u7136\u5982\u6b64\uff0c\u6709\u4e00\u4e9bPython\u4e0b\u8f7d\u5668\u53ef\u4ee5\u4f7f\u7528 &amp; \u5728USB\u9a71\u52a8\u4e0a\u8fd0\u884c\uff0c\u6bd4\u5982<a href=\"http:\/\/portablepython.com\">portablepython.com<\/a>.<\/p>\n<p>IDLE\u7f3a\u4e4f\u4e00\u4e9b\u6709\u7528\u7684\u8c03\u8bd5\u5de5\u5177\u3002<a href=\"http:\/\/wingide.com\/\">Wing IDE<\/a>\u6709\u5f88\u591a\u8c03\u8bd5\u7684\u65b9\u6cd5\uff0c\u5305\u62ec<a href=\"http:\/\/wingide.com\/psupport\/wingide-1.1\/node7.html#SECTION00740000000000000000\">breakpoints<\/a>\uff0c<a href=\"http:\/\/wingide.com\/psupport\/wingide-1.1\/node7.html#SECTION00760000000000000000\">\u5206\u6b65\u6267\u884c<\/a>\uff0c\u89c2\u5bdf\u53d8\u91cf\u548c\u8c03\u7528\u6b21\u5e8f\u3002\u6709\u4e00\u4e9b\u5f88\u96be\u7684\u4e0b\u8f7d\u65b9\u5f0f<a href=\"http:\/\/pydev.org\/\">PyDev<\/a>\u6216<a href=\"http:\/\/www.jetbrains.com\/pycharm\/\">PyCharm<\/a>\u3002<em>\u4e0b\u9762\u7684\u5185\u5bb9\u6211\u4eec\u53ea\u4f1a\u8ba8\u8bba<strong>IDLE<\/strong>\u3002<\/em><\/p>\n<h2>\u4f7f\u7528\u4ea4\u4e92\u6027\u63d0\u793a<\/h2>\n<p>\u6253\u5f00<strong>IDLE<\/strong>\u540e\u4f1a\u51fa\u73b0<em>\u4ea4\u4e92\u6027\u63d0\u793a<\/em>(\u6709\u65f6\u4e5f\u88ab\u53eb\u505a<em>\u58f3<\/em>)\u3002\u5728\u8fd9\u91cc\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165\u6307\u4ee4\uff0c\u7136\u540e\u8ba9\u6307\u4ee4\u7acb\u523b\u6267\u884c\u3002<\/p>\n<pre>&gt;&gt;&gt;<\/pre><code><\/code>\u6807\u8bb0\u8868\u793aPython\u5728\u7b49\u5f85\u4e00\u4e2a\u8f93\u5165\u503c\u3002\u6bd4\u5982\uff0c\u5982\u679c\u4f60\u8f93\u5165<code>print(2+3)<\/code>\uff0c\u7136\u540e\u6309Enter\u952e\uff0c\u4f60\u4f1a\u770b\u5230<\/p>\n<pre>&gt;&gt;&gt; print(2+3)\r\n5<\/pre>\u7b2c\u4e00\u884c\u662f\u4f60\u8981\u6c42Python\u6267\u884c\u7a0b\u5e8f\uff0c\u7b2c\u4e8c\u884c\u662fPython\u7684\u8f93\u51fa\u503c\uff1a\u8bed\u53e5\u7684\u8fd0\u884c\u7ed3\u679c\u5c31\u662fPython\u8ba1\u7b97\u51fa\u4e86\u6570\u5b57<code>5<\/code>\uff0c\u5e76\u5c06\u5176\u6253\u5370\u51fa\u6765\u3002\u4e8b\u5b9e\u4e0a\u4f60\u53ef\u4ee5\u5ffd\u7565<code>print<\/code>:<\/p>\n<pre>&gt;&gt;&gt; 2+3\r\n5<\/pre>\u6362\u53e5\u8bdd\u8bf4\uff0cPython\u9ed8\u8ba4\u6253\u5370\u51fa\u4f60\u8981\u6c42\u6267\u884c\u7684\u8bed\u53e5\u7684\u503c\u3002\u68c0\u67e5\u7248\u672c\u7684\u65b9\u6cd5\uff1a\u5982\u679c\u4f60\u8f93\u5165\u4e0b\u5217\u4e24\u884c\uff0c\u4f60\u4f1a\u770b\u5230CS Circles\u4f7f\u7528\u7684Python\u7248\u672c\u3002<br \/>\n<form class=\"pbform\" action=\"#\" id=\"pbform0\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox0'>\n<div class=\"heading\"><span class=\"title\">Example<\/span><\/div>\u67e5\u770b\u6211\u4eec\u4f7f\u7528\u7684Python\u7248\u672c\u3002\u5982\u679c\u4f60\u5728\u81ea\u5df1\u7684\u7535\u8111\u4e0a\u8fd0\u884c\u8fd9\u4e24\u884c\uff0c\u4f60\u4f1a\u770b\u5230<em>\u4f60<\/em>\u5728\u4f7f\u7528\u7684\u7248\u672c\u3002<div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 58px;'><textarea wrap='off' name='usercode0' id='usercode0'  cols=10 rows=2 readonly='readonly'  style = 'height : 58px;'  class='pyboxCode RO'>\nimport sys\nprint(sys.version_info)<\/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<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(0)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(0,'N')\" ><\/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=\"e58674cc16da28c4cea98460342f7446\"\/>\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(\u6211\u4eec\u4f7f\u7528\u7684\u662f3\u7248\u672c\uff0c\u56e0\u4e3a\u9002\u7528\u4e8e\u521d\u5b66\u8005\u30022\u7248\u672c\u5728\u5f88\u591a\u4ea7\u4e1a\u4e2d\u4f7f\u7528\uff0c\u4f46\u662f3\u7248\u672c\u6e10\u6e10\u5730\u88ab\u66f4\u591a\u4eba\u4f7f\u7528)\u3002<\/p>\n<h2>\u6709\u7528\u7684\u4e8b\u5b9e<\/h2>\n<ul>\n<li>\u5728\u4ea4\u4e92\u6027\u63d0\u793a\u91cc\uff0c\u901a\u8fc7\u4f7f\u7528<code>help<\/code>\u65b9\u7a0b\uff0c\u4f60\u4f1a\u5f97\u5230\u6709\u5173\u5df2\u5b58\u5728\u7684\u65b9\u7a0b\u7684\u5217\u8868\u3002\u6bd4\u5982\uff0c\u8f93\u5165<code>help(print)<\/code>\uff0c\u4f60\u4f1a\u5f97\u5230\u6709\u5173<code>print()<\/code>\u65b9\u7a0b\u7684\u57fa\u672c\u4fe1\u606f\u3002<\/li>\n<li>\u8981\u505c\u6b62\u4e00\u4e2a\u65e0\u9650\u5faa\u73af\u6216\u8981\u5f88\u957f\u65f6\u95f4\u7684\u8ba1\u7b97\uff0c\u4f60\u53ef\u4ee5<em>\u963b\u6b62\/\u7834\u574fbreak<\/em>\u7a0b\u5e8f\uff0c\u901a\u8fc7\u8f93\u5165Ctrl-C\u3002\u5c1d\u8bd5\u4f7f\u7528\n<pre>while (1 &gt; 0): purpose = \"Wasting Time\"<\/pre>\u7136\u540e\u4f7f\u7528Ctrl-C\u505c\u6b62\u7a0b\u5e8f\u3002<\/li>\n<li>\u5982\u679c\u4f60\u4f7f\u7528Python\u4f5c\u4e3a\u4e00\u4e2a\u8ba1\u7b97\u5668\uff0c\u6216\u8005\u505a\u4e00\u4e9b\u5c0f\u578b\u7684\u5b9e\u9a8c\uff0c\u8fd9\u91cc\u662f\u4e00\u4e2a\u6709\u7528\u7684\u5feb\u6377\u952e\u3002\u4e0b\u5212\u7ebf\u5b57\u7b26<code>_<\/code> refers to the result of \u4ea4\u4e92\u6027\u63d0\u793a\u8bc4\u4f30\u51fa\u7684previous expression which\u3002\u6bd4\u5982\uff0c\u5982\u679c\u4f60\u8f93\u5165\u4e00\u884c<code>2+3<\/code>\uff0c\u7136\u540e\u4e0b\u4e00\u884c\u8f93\u5165<code>_*2<\/code>\uff0c\u4f60\u4f1a\u770b\u5230\u4e0b\u5217\u5185\u5bb9\uff1a\n<pre>&gt;&gt;&gt; 2+3\r\n5\r\n&gt;&gt;&gt; _*2\r\n10<\/pre>\n<\/li>\n<\/ul>\n<h2>\u7f16\u8f91\u6587\u6863\/\u6587\u5b57<\/h2>\n<p>\u5982\u679c\u8981\u89e3\u51b3\u4e00\u4e2a\u590d\u6742\u7684\u95ee\u9898\uff0c\u4f60\u9700\u8981\u7f16\u5199\u4e00\u4e2a\u5305\u542b\u591a\u4e2a\u6307\u4ee4\u7684\u957f\u6587\u6863\uff0c\u7c7b\u4f3c\u4e8e\u6211\u4eec\u4e4b\u524d\u5728CS Circles\u7f51\u7ad9\u505a\u7684\u4e8b\u60c5\u3002\u5728<strong>IDLE<\/strong>\u4e2d\u8fd0\u884c\u9700\u8981\u767b\u9646<span style=\"text-decoration: underline;\">\u6587\u4ef6<\/span>\u83dc\u5355\uff0c\u9009\u62e9<span style=\"text-decoration: underline;\">\u65b0<\/span>\u7a97\u53e3(\u6216\u662f\u4f7f\u7528\u5feb\u6377\u952eCtrl-N)\u3002\u8fd9\u4e48\u505a\u5c31\u4f1a\u6253\u5f00\u4e00\u4e2a\u65b0\u7a97\u53e3\uff0c\u4e5f\u5c31\u662f\u4e00\u4e2a\u57fa\u672c\u7684\u6587\u672c\u7f16\u8f91\u5668(\u4e0d\u662f\u4e00\u4e2a\u4ea4\u4e92\u6027\u63d0\u793a)\u3002\u5728\u8fd9\u4e2a\u7a97\u53e3\u7f16\u5199\u4e00\u4e9b\u4ee3\u7801(\u6bd4\u5982\uff0c<code>print(\"Hello, World\")<\/code>)\uff1b\u6ce8\u610f\uff0c\u5f53\u4f60\u6309\u4e0bEnter\u952e\u540e\uff0c\u7a0b\u5e8f\u4e0d\u4f1a\u6267\u884c\u3002\u5728\u4f60\u81ea\u5df1\u7684\u7535\u8111\u4e0a\u50a8\u5b58\u8fd9\u4e2a\u6587\u4ef6(\u5728File\u83dc\u5355\u4e0b\u9009\u62e9Save\uff0c\u6216\u6309Ctrl-S)\u3002\u7136\u540e\u4f60\u53ef\u4ee5\u6267\u884c\u5b83\uff1a\u5728\u8fd0\u884c\u83dc\u5355\u4e0b\u9009\u62e9\u8fd0\u884c\u6a21\u5757(\u6216\u4f7f\u7528\u5feb\u6377\u952eF5)\u3002\u4f60\u4f1a\u5728\u4ea4\u4e92\u7a97\u53e3\u770b\u5230\u4f60\u7684\u7a0b\u5e8f\u7684\u8f93\u51fa\u503c!<\/p>\n<h1>\u4ea4\u4e92\u6027\u8f93\u5165<\/h1>\n<p>\u5f53\u4f60\u5728\u81ea\u5df1\u7684\u7535\u8111\u4e0a\u800c\u4e0d\u662f\u5728CS Circles\u7f51\u7ad9\u4e0a\u8fd0\u884cPython\u65f6\uff0c\u4e00\u4e2a\u4e3b\u8981\u7684\u7279\u70b9\u5c31\u53ef\u4ee5\u5b9e\u73b0\u4e86\uff0c\u4f60\u73b0\u5728\u53ef\u4ee5\u5728\u4ea4\u4e92\u7a97\u53e3\u4f7f\u7528<em>\u4ea4\u4e92\u6027\u8f93\u5165<\/em>\u3002<code>input()<\/code>\u6307\u4ee4\u4f1a\u5f97\u5230\u4e00\u884c\u4f7f\u7528\u8005\u5728\u4ea4\u4e92\u7ffb\u8bd1\u5668\u4e2d\u7684\u8f93\u5165\uff0c\u800c\u4e14\u90a3\u4e2a\u5b57\u7b26\u4e32\u6210\u4e3a\u4e86<code>input()<\/code>\u65b9\u7a0b\u8fd4\u8fd8\u7684\u503c\u3002\u9664\u6b64\u4ee5\u5916\uff0c\u5f53\u4f60\u8c03\u7528\u8f93\u5165\u65b9\u7a0b\u65f6\uff0c\u4f60\u53ef\u4ee5\u628a<em>\u63d0\u793a\u5b57\u7b26\u4e32<\/em>\u5f53\u4f5c\u4e00\u4e2a\u53c2\u6570\uff0c\u8fd9\u6837\u5c31\u80fd\u591f\u6307\u793a\u4f7f\u7528\u8005\u8be5\u505a\u4ec0\u4e48\u3002\u6211\u4eec\u5728\u8fd9\u91cc\u7528\u4e00\u4e2a\u5c0f\u4f8b\u5b50\u8bf4\u660e\u8fd9\u4e2a\u95ee\u9898...\u5c06\u5b83\u590d\u5236\u5230\u4f60\u7684IDLE\u7f16\u8f91\u5668\u4e2d\uff0c\u7136\u540e\u4fdd\u5b58\u5e76\u6267\u884c\u3002<\/p>\n<pre>print(\"Good day!\")\r\nusername = input(\"What is your name? \")\r\nprint(\"Nice to meet you,\", username)<\/pre>\n<h2>\u4ea4\u4e92\u6027\u4f8b\u5b50\uff1a\u731c\u6e38\u620f<\/h2>\n<p>\u8fd9\u91cc\u6211\u4eec\u63d0\u4f9b\u4e00\u4e2a\u663e\u73b0\u4ea4\u4e92\u6027\u8f93\u5165\u7684\u91cd\u8981\u6027\u7684\u4f8b\u5b50\uff1a\u4f60\u548c\u8ba1\u7b97\u673a\u8fdb\u884c\u7ade\u731c\u6e38\u620f\u3002\u6211\u4eec\u4f1a\u4f7f\u7528\u4e00\u4e2a<code>random<\/code>\u5305\u88f9\u91cc\u7684\u65b9\u7a0b\uff1a<code>random.randint(A, B)<\/code>\u65b9\u7a0b\u968f\u673a\u4ea7\u751f\u4e00\u4e2a<code>A<\/code>\u548c<code>B<\/code>\u4e4b\u95f4\u7684\u6574\u6570(\u5305\u62ecA\uff0cB)\u3002\u901a\u8fc7\u4f7f\u7528\u8fd9\u4e9b\u65b9\u7a0b\uff0c\u6211\u4eec\u53ef\u4ee5\u8bbe\u8ba1\u4e00\u4e2a\u5c0f\u6e38\u620f\uff1a\u590d\u5236\u4e0b\u5217\u4ee3\u7801\u5230\u4f60\u7684\u7f16\u8f91\u5668\u4e2d\uff0c\u4fdd\u5b58\u5e76\u8fd0\u884c\u3002<\/p>\n<pre>import random\r\nsecretNumber = random.randint(1, 100)\r\nprint(\"I'm thinking of a secret number between 1 and 100...\")\r\nwhile True:\r\n    guess = int(input(\"What is your guess? \"))\r\n    if (guess == secretNumber):\r\n        break\r\n    if (guess &gt; secretNumber):\r\n        print(\"Sorry, your guess is too high.\")\r\n    if (guess &lt; secretNumber):\r\n        print(\"Sorry, your guess is too low.\")\r\nprint(\"Dang, you got it!\")<\/pre>\n<h2>\u7136\u540e...<\/h2>\n<p>\u5982\u679c\u4f60\u5bf9\u8fd9\u4e9b\u7a0b\u5e8f\u611f\u5174\u8da3\uff0c\u90a3\u4e48\u518d\u521b\u9020\u4e00\u4e9b\u66f4\u52a0\u590d\u6742\u7684\u7a0b\u5e8f\uff0c\u6bd4\u5982\u4e00\u4e2a\u53ef\u4ee5\u8f6c\u6362\u8ba1\u91cf\u5355\u4f4d\u7684\u4ea4\u4e92\u5f0f\u7a0b\u5e8f\u3002\u5982\u679c\u4f60\u5df2\u7ecf\u5728\u81ea\u5df1\u7684\u7535\u8111\u4e0a\u8fd0\u884c\u4e86Python\uff0c\u90a3\u4e48\u8fd9\u91cc\u662f\u4e00\u4e9b\u4f60\u73b0\u5728\u53ef\u4ee5\u5c1d\u8bd5\u505a\u7684\u4e8b\u60c5\uff1a<\/p>\n<ul>\n<li><a href=\"http:\/\/docs.python.org\/py3k\/library\/turtle.html#module-turtle\">Python<strong>turtle<\/strong>\u6a21\u5757<\/a>\u53ef\u4ee5\u7528\u6765\u5efa\u7acb\u7ebf\u5f62\u56fe\u548c\u51e0\u4f55\u52a8\u753b\uff01<\/li>\n<li>\u4f60\u53ef\u4ee5\u7f16\u5199\u4e00\u4e2aPython\u7a0b\u5e8f\uff0c\u7528\u6765<a href=\"http:\/\/docs.python.org\/tutorial\/inputoutput.html#reading-and-writing-files\">\u8bfb\u548c\u5199\u6587\u6863<\/a>\uff1b<\/li>\n<li>\u4f60\u53ef\u4ee5\u7528Python\u6765<a href=\"http:\/\/stackoverflow.com\/questions\/1967040\/how-can-i-create-a-melody-is-there-any-sound-module\">\u521b\u9020\u97f3\u4e50\u7684\u54d7\u54d7\u58f0<\/a>\uff01<\/li>\n<\/ul>\n<p>\u5982\u679c\u4f60\u60f3\u627e\u4e00\u4e2a\u53ef\u4ee5\u751f\u52a8\u5730\u89e3\u91caPython\u7684\u4ea4\u4e92\u6027\u80cc\u540e\u7684\u4e50\u8da3\u548c\u60f3\u6cd5\u7684\u8d44\u6e90\uff0c\u6211\u4eec\u5efa\u8bae\u4f60\u770b\u4e00\u672c\u514d\u8d39\u7684\u4e66<a href=\"http:\/\/inventwithpython.com\/\">Invent Your Own Computer Games With Python<\/a>\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> \u60f3\u8981\u5728Windows\u4e0a\u8fd0\u884cPython3\u4e2d\u7684Pygame\u7684\u8bdd\uff0c<a href=\"http:\/\/www.lfd.uci.edu\/~gohlke\/pythonlibs\/#pygame\">\u989d\u5916\u7684\u8d44\u6e90\u53ef\u4ee5\u5728\u8fd9\u91cc\u627e\u5230<\/a>\u3002  <\/span><\/td><\/table><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f60\u5728CS Circles\u63d0\u4ea4\u7684\u4ee3\u7801\u662f\u901a\u8fc7Python\u7684\u590d\u5236\u54c1\u5728\u7f51\u7ad9\u670d\u52a1\u5668\u8fd0\u884c\uff0c\u53ef\u4ee5\u8ba9\u6211\u4eec\u81ea\u52a8\u8bc4\u5224\u3002\u7136\u800c\uff0c\u66f4\u4f20\u7edf\u7684\u7f16\u7a0b\u65b9\u5f0f\u662f\u4f60\u5728\u7535\u8111\u4e0a\u4e0b\u8f7d\u4e00\u4e2aPython\u7ffb\u8bd1\u5668\u3002\u5728\u81ea\u5df1\u5bb6\u91cc\u8fd0\u884cPython\u6709\u51e0\u4e2a\u989d\u5916\u597d\u5904\uff1a(i)\u4f60\u4e0d\u53d7\u9650\u4e8e\u5728\u6211\u4eec\u7684\u7f51\u7ad9\u670d\u52a1\u5668\u4e0a\u5206\u4eab\u6709\u9650\u7684\u8d44\u6e90\uff1b(ii)\u4f60\u53ef\u4ee5\u7f16\u5199\u4ea4\u4e92\u5f0f\u7a0b\u5e8f(\u89c1\u4e0b\u6587)\uff1b(iii)\u8f6f\u4ef6\u88ab\u4e0b\u8f7d\u540e\uff0c\u4f60\u4e0d\u9700\u8981\u8054\u7f51\u518d\u8fd0\u884c\u7a0b\u5e8f; (iv)\u4f60\u53ef\u4ee5\u4f7f\u7528\u8c03\u8bd5\u5de5\u5177\uff0c\u58f0\u97f3\uff0c\u548c\u5236\u56fe\u5b66\u3002 \u514d\u8d39\u7684Python\u5de5\u5177 \u4e0d\u8bba\u662fWindows\uff0cMac\uff0c\u8fd8\u662fLinux\uff0c\u4e3a\u4e86\u8ba9Python\u5728\u81ea\u5df1\u7684\u7535\u8111\u4e0a\u8fd0\u884c\uff0c\u4f60\u53ef\u4ee5\u5728Python.org\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u3002\u70b9\u51fb\u8fd9\u91cc\u6765\u767b\u9646Python\u4e0b\u8f7d\u9875\u9762\u3002\u9009\u62e9\u6700\u65b0\u76843.x\u7248\u672c\uff0c\u9009\u62e9\u5339\u914d\u4f60\u7684\u7535\u8111\u673a\u578b\u7684\u4e0b\u8f7d\u5668(\u6bd4\u5982\uff0c\u5bf9\u4e8e32-bit\u7684Windows\u7cfb\u7edf\uff0c\u9009\u62e9\"Windows x86 MSI Installer\")\uff0c\u7136\u540e\u4e0b\u8f7d\u5e76\u8fd0\u884c\u4e0b\u8f7d\u5668\u3002\u4e0b\u8f7d\u540e\uff0c\u8fd0\u884c\u540d\u4e3aIDLE\u7684\u7a0b\u5e8f\u4f1a\u6253\u5f00\u4e00\u4e2a\u4ea4\u4e92\u6027Python\u63d0\u793a\u3002 \u63d0\u793a\uff1a\u5982\u679c\u4f60\u4f7f\u7528\u5b66\u6821\u7684\u7535\u8111\uff0c\u4f60\u6216\u8bb8\u4e0d\u80fd\u5b8c\u6210\u4e0b\u8f7d\uff0c\u56e0\u4e3a\u4f1a\u6709\u6743\u9650\u7684\u95ee\u9898\uff1b\u6216\u8bb8\u9700\u8981\u5f97\u5230\u6743\u9650\uff0c\u9700\u8981\u7f51\u7edc\u7ba1\u7406\u5458\u3002\u867d\u7136\u5982\u6b64\uff0c\u6709\u4e00\u4e9bPython\u4e0b\u8f7d\u5668\u53ef\u4ee5\u4f7f\u7528 &amp; \u5728USB\u9a71\u52a8\u4e0a\u8fd0\u884c\uff0c\u6bd4\u5982portablepython.com. IDLE\u7f3a\u4e4f\u4e00\u4e9b\u6709\u7528\u7684\u8c03\u8bd5\u5de5\u5177\u3002Wing IDE\u6709\u5f88\u591a\u8c03\u8bd5\u7684\u65b9\u6cd5\uff0c\u5305\u62ecbreakpoints\uff0c\u5206\u6b65\u6267\u884c\uff0c\u89c2\u5bdf\u53d8\u91cf\u548c\u8c03\u7528\u6b21\u5e8f\u3002\u6709\u4e00\u4e9b\u5f88\u96be\u7684\u4e0b\u8f7d\u65b9\u5f0fPyDev\u6216PyCharm\u3002\u4e0b\u9762\u7684\u5185\u5bb9\u6211\u4eec\u53ea\u4f1a\u8ba8\u8bbaIDLE\u3002 \u4f7f\u7528\u4ea4\u4e92\u6027\u63d0\u793a \u6253\u5f00IDLE\u540e\u4f1a\u51fa\u73b0\u4ea4\u4e92\u6027\u63d0\u793a(\u6709\u65f6\u4e5f\u88ab\u53eb\u505a\u58f3)\u3002\u5728\u8fd9\u91cc\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165\u6307\u4ee4\uff0c\u7136\u540e\u8ba9\u6307\u4ee4\u7acb\u523b\u6267\u884c\u3002 &gt;&gt;&gt;\u6807\u8bb0\u8868\u793aPython\u5728\u7b49\u5f85\u4e00\u4e2a\u8f93\u5165\u503c\u3002\u6bd4\u5982\uff0c\u5982\u679c\u4f60\u8f93\u5165print(2+3)\uff0c\u7136\u540e\u6309Enter\u952e\uff0c\u4f60\u4f1a\u770b\u5230 &gt;&gt;&gt; print(2+3) 5\u7b2c\u4e00\u884c\u662f\u4f60\u8981\u6c42Python\u6267\u884c\u7a0b\u5e8f\uff0c\u7b2c\u4e8c\u884c\u662fPython\u7684\u8f93\u51fa\u503c\uff1a\u8bed\u53e5\u7684\u8fd0\u884c\u7ed3\u679c\u5c31\u662fPython\u8ba1\u7b97\u51fa\u4e86\u6570\u5b575\uff0c\u5e76\u5c06\u5176\u6253\u5370\u51fa\u6765\u3002\u4e8b\u5b9e\u4e0a\u4f60\u53ef\u4ee5\u5ffd\u7565print: &gt;&gt;&gt; 2+3 5\u6362\u53e5\u8bdd\u8bf4\uff0cPython\u9ed8\u8ba4\u6253\u5370\u51fa\u4f60\u8981\u6c42\u6267\u884c\u7684\u8bed\u53e5\u7684\u503c\u3002\u68c0\u67e5\u7248\u672c\u7684\u65b9\u6cd5\uff1a\u5982\u679c\u4f60\u8f93\u5165\u4e0b\u5217\u4e24\u884c\uff0c\u4f60\u4f1a\u770b\u5230CS Circles\u4f7f\u7528\u7684Python\u7248\u672c\u3002 Example\u67e5\u770b\u6211\u4eec\u4f7f\u7528\u7684Python\u7248\u672c\u3002\u5982\u679c\u4f60\u5728\u81ea\u5df1\u7684\u7535\u8111\u4e0a\u8fd0\u884c\u8fd9\u4e24\u884c\uff0c\u4f60\u4f1a\u770b\u5230\u4f60\u5728\u4f7f\u7528\u7684\u7248\u672c\u3002 import sys print(sys.version_info) (\u6211\u4eec\u4f7f\u7528\u7684\u662f3\u7248\u672c\uff0c\u56e0\u4e3a\u9002\u7528\u4e8e\u521d\u5b66\u8005\u30022\u7248\u672c\u5728\u5f88\u591a\u4ea7\u4e1a\u4e2d\u4f7f\u7528\uff0c\u4f46\u662f3\u7248\u672c\u6e10\u6e10\u5730\u88ab\u66f4\u591a\u4eba\u4f7f\u7528)\u3002 \u6709\u7528\u7684\u4e8b\u5b9e \u5728\u4ea4\u4e92\u6027\u63d0\u793a\u91cc\uff0c\u901a\u8fc7\u4f7f\u7528help\u65b9\u7a0b\uff0c\u4f60\u4f1a\u5f97\u5230\u6709\u5173\u5df2\u5b58\u5728\u7684\u65b9\u7a0b\u7684\u5217\u8868\u3002\u6bd4\u5982\uff0c\u8f93\u5165help(print)\uff0c\u4f60\u4f1a\u5f97\u5230\u6709\u5173print()\u65b9\u7a0b\u7684\u57fa\u672c\u4fe1\u606f\u3002 \u8981\u505c\u6b62\u4e00\u4e2a\u65e0\u9650\u5faa\u73af\u6216\u8981\u5f88\u957f\u65f6\u95f4\u7684\u8ba1\u7b97\uff0c\u4f60\u53ef\u4ee5\u963b\u6b62\/\u7834\u574fbreak\u7a0b\u5e8f\uff0c\u901a\u8fc7\u8f93\u5165Ctrl-C\u3002\u5c1d\u8bd5\u4f7f\u7528 while (1 &gt; 0): purpose = \"Wasting Time\"\u7136\u540e\u4f7f\u7528Ctrl-C\u505c\u6b62\u7a0b\u5e8f\u3002 \u5982\u679c\u4f60\u4f7f\u7528Python\u4f5c\u4e3a\u4e00\u4e2a\u8ba1\u7b97\u5668\uff0c\u6216\u8005\u505a\u4e00\u4e9b\u5c0f\u578b\u7684\u5b9e\u9a8c\uff0c\u8fd9\u91cc\u662f\u4e00\u4e2a\u6709\u7528\u7684\u5feb\u6377\u952e\u3002\u4e0b\u5212\u7ebf\u5b57\u7b26_ &hellip; <a href=\"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/run-at-home-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-9490","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/pages\/9490","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=9490"}],"version-history":[{"count":15,"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/pages\/9490\/revisions"}],"predecessor-version":[{"id":9517,"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/pages\/9490\/revisions\/9517"}],"wp:attachment":[{"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/media?parent=9490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}