{"id":9235,"date":"2016-05-29T12:26:19","date_gmt":"2016-05-29T16:26:19","guid":{"rendered":"http:\/\/cscircles.cemc.uwaterloo.ca\/?page_id=9235"},"modified":"2017-06-29T11:45:20","modified_gmt":"2017-06-29T15:45:20","slug":"zh-7a","status":"publish","type":"page","link":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/zh-7a\/","title":{"rendered":"7A: \u5b57\u7b26\u4e32"},"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><em>\u7b2c7\u8282\u8bfe\u6709\u4e09\u4e2a\u90e8\u5206\uff1aA\uff0cB\uff0cC\u3002\u6ca1\u6709\u987a\u5e8f\u3002<\/em><\/p>\n<p>\u76ee\u524d\u4e3a\u6b62\uff0c\u6211\u4eec\u53ea\u662f\u7b80\u5355\u7684\u4f7f\u7528\u4e86\u5b57\u7b26\u4e32\uff08\u7c7b\u578b\u662f<code>str<\/code>\uff09\u3002\u8fd9\u95e8\u8bfe\u6211\u4eec\u4f1a\u5bf9\u5b57\u7b26\u4e32\u505a\u51fa\u4e00\u4e9b\u5904\u7406\uff1a\u5206\u79bb\u3001\u7ec4\u5408\u5b57\u7b26\uff0c\u67e5\u770b\u5b57\u7b26\u4e32\u4e2d\u5355\u72ec\u7684<em>\u5b57\u7b26<\/em>\u3002<\/p>\n<h2>\u4ec0\u4e48\u662f\u5b57\u7b26\uff1f<\/h2>\n<p>\u8ba1\u7b97\u673a\u91cc\u7684\u6570\u636e\u57fa\u672c\u4e0a\u90fd\u662f\u4ee5 0 \u548c 1 \u7684\u5e8f\u5217\u5f62\u5f0f\u50a8\u5b58\u7684\uff1a\u6bd4\u5982\u6587\u672c\uff0c\u7535\u5b50\u4e66\uff0c\u56fe\u7247\uff0c\u6b4c\u66f2\uff0c\u89c6\u9891\uff0c\"\u53ef\u6267\u884c\u6587\u4ef6\"\u5982\u6e38\u620f\u548c\u5e94\u7528\u3002\u5b57\u7b26\u4e32\u662f\u4e00\u79cd\u6587\u672c\u6570\u636e\uff0c\u4ee5\u5982\u4e0b\u5f62\u5f0f\u50a8\u5b58\uff1a<\/p>\n<ul>\n<li>\u5b57\u7b26\u4e32\u662f\u4e00\u7cfb\u5217\u5b57\u7b26\u7ec4\u6210\u7684\uff08\u6bd4\u5982\uff0c\u5b57\u7b26\u4e32\"Hello, World!\"\u5305\u542b13\u4e2a\u5b57\u7b26\uff0c\u5982\"H\"\uff0c\"e\"\u548c\u6807\u70b9\" \"\uff0c\"!\"\u3002<\/li>\n<li>\u6bcf\u4e2a\u5b57\u7b26\u5b9e\u9645\u4e0a\u7531\u4e00\u4e2a\u6570\u5b57\u8868\u793a\uff08\"H\"\u662f\u753140\u8868\u793a\uff1b\u8fd9\u662f<a href=\"http:\/\/en.wikipedia.org\/wiki\/ASCII\">\u7f8e\u56fd\u4fe1\u606f\u4ea4\u6362\u6807\u51c6\u4ee3\u7801<\/a>\/<a href=\"http:\/\/en.wikipedia.org\/wiki\/Unicode\">\u7edf\u4e00\u7801<\/a>\uff09<\/li>\n<\/ul>\n<p>\uff08\u6570\u5b57\u662f\u4ee50-1<a href=\"http:\/\/en.wikipedia.org\/wiki\/Binary_numeral_system\">\u4e8c\u8fdb\u5236<\/a>\u5f62\u5f0f\u50a8\u5b58\u3002\uff09<\/p>\n<h2>\u5c06\u5b57\u7b26\u4e32\u770b\u4f5c\u4e3a\u5b57\u7b26\u7684\u5e8f\u5217: <code>S[]<\/code><\/h2>\n<p>\u4e3a\u4e86\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u64cd\u4f5c\uff0c\u6211\u4eec\u9700\u8981\u63d0\u53d6\u51fa\u5b57\u7b26\u4e32\u91cc\u7684\u6bcf\u4e2a\u5b57\u7b26\u3002\u5728Python\u4e2d\uff0c\u8fd9\u662f\u4ee5\u5982\u4e0b\u65b9\u5f0f\u8fdb\u884c\uff1a\u6211\u4eec\u6709\u4e00\u4e2a\u5b57\u7b26\u4e32<code>S<\/code>\u548c\u4e00\u4e2a\u6574\u6570<code>index<\/code>\uff0c<\/p>\n<pre>S[index]<\/pre>\u8fd4\u8fd8\u4e86\u5b57\u7b26\u4e32<code>S<\/code>\u4e2d\u7684\u7b2c<code>index<\/code>\u4f4d\u5b57\u7b26\u3002<strong>\u6309\u7167\u60ef\u4f8b<\/strong>\uff0c\u5b57\u7b26\u4e32\u4ee5\u7d22\u5f150\u5f00\u59cb\uff1a\u6240\u4ee5<code>S[0]<\/code>\u662f\u7b2c\u4e00\u4e2a\u5b57\u7b26\uff0c<code>S[1]<\/code>\u662f\u7b2c\u4e8c\u4e2a\u5b57\u7b26\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002\u5728\"Hello, World!\"\u4e2d\uff1a<\/p>\n<pre>\u7d22\u5f15\uff1a0 \u00a01 \u00a02 \u00a03 \u00a04 \u00a05 \u00a06 \u00a07 \u00a08 \u00a09 10 11 12\r\n\u5b57\u7b26: H \u00a0e \u00a0l \u00a0l \u00a0o \u00a0, \u00a0 \u00a0 W \u00a0o \u00a0r \u00a0l \u00a0d \u00a0!<\/pre>\u6ce8\u610f\uff1a\u7d22\u5f156\u662f\u7a7a\u683c\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> \u5728\u5f88\u591a\u5176\u4ed6\u7684\u7f16\u7a0b\u8bed\u8a00\u4e2d\uff0c\u5b57\u7b26\u53e6\u6709\u4e00\u4e2a\u7c7b\u522b\u3002\u5728 Python \u4e2d\uff0c\u5b57\u7b26\u662f\u957f\u5ea6\u4e3a 1 \u7684\u5b57\u7b26\u4e32\uff0c\u6240\u4ee5\u4ed6\u4eec\u7684\u7c7b\u578b \u662f str\u3002 <a href=\"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/console\/?consolecode=ch%20%3D%20%22Hi%22%5B0%5D%0Aprint%28ch%29%0Aprint%28type%28ch%29%29%0Aprint%28len%28ch%29%29\" target=\"_blank\"><\/a>\u3002 <\/span><\/td><\/table><\/p>\n<h2>\u5f97\u51fa\u5b57\u7b26\u4e32\u7684\u5b57\u7b26\u4e2a\u6570\uff1a<code>len<\/code><\/h2>\n<p>\u4e3a\u4e86\u5f97\u5230\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u4e2a\u6570\uff0c\u6211\u4eec\u4f7f\u7528Python\u4e2d\u7684\u65b9\u7a0b<code>len<\/code>\u3002\u6bd4\u5982\uff0c<code>len(\"Hello, World!\")<\/code>\u5f97\u51fa13\u3002<\/p>\n<div class='pybox modeNeutral' id='pybox0'>\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'>Multiple Choice Exercise: <\/span><span class='title'>\u6700\u540e\u4e00\u4e2a\u5b57\u7b26<\/span><\/div><div>\u54ea\u4e00\u4e2a\u4ee3\u7801\u53ef\u4ee5\u7528\u6765\u5f97\u51fa\u5b57\u7b26\u4e32<code>S<\/code>\u4e2d<strong>\u6700\u540e\u4e00\u4e2a<\/strong>\u5b57\u7b26?<\/div><label>Your choice: <\/label><select id=\"pyselect0\"><option value=\"d\" selected>Select one<\/option><option value=\"r\">S[len(S)-1]<\/option><option value=\"w\">S[len(S)+1]<\/option><option value=\"w\">S[len(S)]<\/option><\/select><div class='pyboxbuttons'><input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" name=\"slug\" value=\"7a.last\"\/><input type='submit' style='margin:5px;' value='Check answer' onClick='pbMultiCheck(0)'\/><\/div><div class=\"pbresults\" id=\"pyMultiResults0\"><\/div><div class=\"epilogue\">\u6b63\u786e\uff01\u867d\u7136<code>len(S)<\/code>\u5f97\u51fa\u5b57\u7b26\u4e32\u7684\u5b57\u7b26\u603b\u6570\uff0c\u4f46\u56e0\u4e3a\u7d22\u5f15\u662f\u4ece<code>0<\/code>\u5f00\u59cb\uff0c\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\u7684\u7d22\u5f15\u662f<code>len(S)-1<\/code>\u3002<\/div><\/div>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528<code>len<\/code>\u548c<code>[]<\/code>\u7684\u4f8b\u5b50\u3002<br \/>\n<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'>\u5b57\u7b26\u4e32\u957f\u5ea6\u548c\u5b57\u7b26<\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 110px;'><textarea wrap='off' name='usercode1' id='usercode1'  cols=10 rows=4 readonly='readonly'  style = 'height : 110px;'  class='pyboxCode RO'>\nmagic = 'Abracadabra!'\nprint(magic)\nprint(len(magic))\nprint(magic[0], magic[1], magic[len(magic)-1])<\/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<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(1)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(1,'N')\" ><\/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=\"372a8bdf2fe9fab2f6e6771b990265ff\"\/>\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<h2>\u622a\u53d6\u5b57\u7b26\u4e32\uff1a<code>S[:]<\/code><\/h2>\n<p>\u622a\u53d6\u5b57\u7b26\u4e32\u7684\u67d0\u4e00\u90e8\u5206\u4f1a\u7ed9\u4f60\u4e00\u4e2a<strong>\u5b50\u94fe<\/strong>\u3002\u6bd4\u5982\uff0c\u5b57\u7b26\u4e32\"eat\"\u548c\"ted\"\u662f\"repeated\"\u7684\u5b50\u94fe\u3002\u4e3a\u4e86\u5728Python\u4e2d\u63d0\u53d6\u51fa\u4e00\u4e2a\u5b50\u94fe\uff0c\u6211\u4eec\u8981\u7528\u5230<\/p>\n<pre>S[firstIndex:tailIndex]<\/pre>\u6765\u83b7\u5f97\u5b50\u94fe\uff0c\u4ece\u7d22\u5f15<strong>firstIndex<\/strong>\u5f00\u59cb\u5230<strong>tailIndex-1<\/strong>\u7ed3\u675f\u3002\u5728\u8fd0\u884c\u4e0b\u5217\u7a0b\u5e8f\u524d\u5148\u60f3\u4e00\u4e0b\u4e0b\u5217\u7a0b\u5e8f\u7684\u8f93\u51fa\u90fd\u662f\u4ec0\u4e48\u3002<br \/>\n<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'>\u5b50\u5b57\u7b26\u4e32<\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 110px;'><textarea wrap='off' name='usercode2' id='usercode2'  cols=10 rows=4 readonly='readonly'  style = 'height : 110px;'  class='pyboxCode RO'>\nmyString = 'Weighty'\nprint(myString[1:6])\nprint('magic'[3:3])\nprint('chump'[0:4])<\/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<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(2)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(2,'N')\" ><\/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=\"3d46ad9fe12c1f31df91ec52188a16f8\"\/>\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><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> \u6ce8\u610f\u5728\u622a\u53d6\u5b50\u94fe\u7684\u65f6\u5019\uff0cfirstIndex\u662f<strong>\u5305\u62ec<\/strong>\u5728\u5b50\u94fe\u91cc\u7684\uff0c\u800ctailIndex\u662f<strong>\u4e0d\u5305\u62ec<\/strong>\u7684\u3002\u8fd9\u662f\u4e00\u4e2a\u5e38\u72af\u7684\u9519\u8bef\u3002\u7136\u800c\uff0c\u5b83\u4e5f\u6709\u4e00\u4e9b\u597d\u7684\u4f5c\u7528\u3002\u6bd4\u5982\uff0c\u56e0\u4e3a\u8fd9\u79cd\u5f62\u5f0f\uff0c\u5b50\u94fe s[i: j]\u7684\u957f\u5ea6\u662f\u603b\u662f j-i\u3002\u8fd9\u4e00\u7ba1\u7406\u5e38\u5e38\u88ab\u63cf\u8ff0\u6210\u4e00\u628a\u5c3a\u5b50\uff1a<img decoding=\"async\" class=\" aligncenter\" style=\"border: none; text-align: center; margin-left: auto; margin-right: auto; float: none;\" src=\"..\/wp-content\/lesson_files\/img\/7\/substring-zh.png\" alt=\"\" \/> <\/span><\/td><\/table><\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform3\" method=\"POST\">\n<div class='pybox modeNeutral ' id='pybox3'>\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'>\u5b57\u7b26\u4e32\u5254\u9664<\/span><\/div>\u5199\u4e00\u6bb5\u7a0b\u5e8f\u4f7f\u5176\u4f7f\u7528<code>input()<\/code>\u8bfb\u53d6\u5b57\u7b26\u4e32\uff0c\u8f93\u51fa\u7684\u5b57\u7b26\u4e32\u4e0d\u8981\u7b2c\u4e00\u4e2a\u548c\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\uff0c\u5176\u4f59\u7684\u4e0d\u53d8\u3002\uff08\u5047\u8bbe\u539f\u5b57\u7b26\u4e32\u957f\u5ea6\u81f3\u5c11\u662f2\uff09\u6bd4\u5982\uff0cinput<code>Fairy<\/code>\u4f1a\u6253\u5370\u51fa<code>air<\/code>\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='usercode3' id='usercode3'  cols=10 rows=20   class='pyboxCode RW'>\n<\/textarea><\/div>\n<div id='pbhistory3' class='flexcontain' style='display:none;'><\/div>\n<div name=\"pyinput\" id=\"pyinput3\">You may enter input for the program in the box below.<div class=\"pyboxTextwrap resizy\" style=\"height: 102px;\" ><textarea wrap=\"off\" name=\"userinput\" class=\"pyboxInput\" cols=10 rows=4><\/textarea><\/div><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit3' value=' '\/><\/td>\n<td><input type='button' name='switch' id=\"switch3\" value=\"Input Switch\" onclick=\"pbInputSwitch(3,'N')\" ><\/td>\n<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(3)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(3,'N')\" ><\/td>\n<\/tr><\/table><select id='pbSelect3' class='selectmore'><option name='more'>More actions...<\/option>\n<option name='history' data-pbonclick=\"historyClick(3,'7a.firstlast')\" >History<\/option>\n<option name='help' data-pbonclick=\"helpClick(3);\" >Help<\/option>\n<\/select><\/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=\"66d4251ab35d5d17a7973da992260c4a\"\/>\n<div id='pbresults3' class='pbresults avoidline'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>jQuery(function(){pbToggleCodeMirror(3);});pbInputSwitch(3,\"N\");<\/script>\n<\/p>\n<h2>\u7c98\u8d34\u5b57\u7b26\u4e32\uff1a<code>+<\/code><\/h2>\n<p>\u6211\u4eec\u77e5\u90531+2=3\u3002\u5bf9\u4e8e\u5b57\u7b26\u4e32\u6765\u8bf4\uff0c\u6211\u4eec\u5374\u5f97\u5230\u7684\u662f\u5982\u4e0b\u7ed3\u679c\uff1a<br \/>\n<form class=\"pbform\" action=\"#\" id=\"pbform4\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox4'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'>\u5b57\u7b26\u4e32\u52a0\u6cd5<\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 84px;'><textarea wrap='off' name='usercode4' id='usercode4'  cols=10 rows=3 readonly='readonly'  style = 'height : 84px;'  class='pyboxCode RO'>\nresult = 'one' + 'two'\nprint(result)\nprint(len(result))<\/textarea><\/div>\n<div id='pbhistory4' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit4' value=' '\/><\/td>\n<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(4)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(4,'N')\" ><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"\"\/><input type=\"hidden\" id=\"inputInUse4\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"4\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"cc2452ab7eda9017a307db46091100ce\"\/>\n<div id='pbresults4' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit4\").value = \"Run program\";document.getElementById(\"inputInUse4\").value = \"N\";<\/script>\n<\/p>\n<p>\u6b63\u5982\u4f60\u6240\u770b\u5230\u7684\u90a3\u6837\uff0c<code>S+T<\/code>\u4f1a\u5f97\u51fa\u4e00\u4e2a\u7531<code>S<\/code>\u548c<code>T<\/code>\u4f9d\u6b21\u8fde\u63a5\u7684\u65b0\u5b57\u7b26\u4e32\u3002\u8fd9\u4e2a\u5b57\u7b26\u4e32\u7c98\u8d34\u64cd\u4f5c\u4e5f\u53eb\u505a<strong>\u8fde\u63a5\u7b26<\/strong>\u3002<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform5\" method=\"POST\">\n<div class='pybox modeNeutral ' id='pybox5'>\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'>\u5934\u548c\u5c3e\u5df4<\/span><\/div>\u7f16\u5199\u4e00\u4e2a\u7a0b\u5e8f\u6765\u7528<code>input()<\/code>\u8bfb\u53d6\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u8f93\u51fa\u7684\u5b57\u7b26\u4e32\u7b2c\u4e00\u4f4d\u548c\u6700\u540e\u4e00\u4f4d\u5747<strong>\u4e92\u6362<\/strong>\uff0c\u5176\u4f59\u7684\u4e00\u81f4\u3002(\u5047\u8bbe\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u957f\u5ea6\u81f3\u5c11\u4e3a2\uff09\u3002\u4f8b\u5982\uff0c\u8f93\u5165<code>Fairy<\/code>\u4f1a\u6253\u5370\u51fa<code>yairF<\/code>\u3002\u63d0\u793a\uff1a\u7b54\u6848\u4e0e\u4e0a\u4e00\u9898\u6709\u90e8\u5206\u91cd\u53e0\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='usercode5' id='usercode5'  cols=10 rows=20   class='pyboxCode RW'>\n<\/textarea><\/div>\n<div id='pbhistory5' class='flexcontain' style='display:none;'><\/div>\n<div name=\"pyinput\" id=\"pyinput5\">You may enter input for the program in the box below.<div class=\"pyboxTextwrap resizy\" style=\"height: 102px;\" ><textarea wrap=\"off\" name=\"userinput\" class=\"pyboxInput\" cols=10 rows=4><\/textarea><\/div><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit5' value=' '\/><\/td>\n<td><input type='button' name='switch' id=\"switch5\" value=\"Input Switch\" onclick=\"pbInputSwitch(5,'N')\" ><\/td>\n<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(5)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(5,'N')\" ><\/td>\n<\/tr><\/table><select id='pbSelect5' class='selectmore'><option name='more'>More actions...<\/option>\n<option name='history' data-pbonclick=\"historyClick(5,'7a.swap')\" >History<\/option>\n<option name='help' data-pbonclick=\"helpClick(5);\" >Help<\/option>\n<\/select><\/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=\"92088f061c9030b765754c7f6a8dd79e\"\/>\n<div id='pbresults5' class='pbresults avoidline'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>jQuery(function(){pbToggleCodeMirror(5);});pbInputSwitch(5,\"N\");<\/script>\n<\/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> \u5982\u679c\u60f3\u8981\u8fde\u63a5\u6570\u5b57\uff0c\u90a3\u4e48\u5c31\u9700\u8981\u5148\u628a\u6570\u5b57\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u3002\u5426\u5219\u7684\u8bdd\u5c31\u4f1a\u5f97\u5230\u4e24\u79cd\u9519\u8bef\u4e2d\u7684\u4e00\u4e2a\uff0c\u6839\u636e\u4f60\u5c1d\u8bd5\u7684\u987a\u5e8f\u3002\u8fd0\u884c\u8fd9\u4e2a\u7a0b\u5e8f\uff0c\u89c2\u5bdf\u4f1a\u5f97\u5230\u4ec0\u4e48\u9519\u8bef\u3002<form class=\"pbform\" action=\"#\" id=\"pbform6\" method=\"POST\">\n<div class='pybox modeNeutral scramble facultative' id='pybox6'>\n<div class=\"heading\"><span class=\"title\">Example<\/span><\/div>\u91cd\u65b0\u6392\u5217\u884c\u7684\u987a\u5e8f\uff0c\u4f1a\u5f97\u5230\u4e24\u79cd\u8fde\u63a5\u9519\u8bef<ul class=\"pyscramble\" name=\"pyscramble\" id=\"pyscramble6\">\n <li class=\"pyscramble\">print(&quot;high &quot; + 5)<\/li>\n <li class=\"pyscramble\">print(110 + &quot; percent&quot;)<\/li>\n<\/ul>\n<input type='hidden' id='usercode6' name='usercode6'\/>\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=\"42f55e078525cdaf706e417b10880dee\"\/>\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\u8fd9\u662f\u4e00\u4e2a\u6b63\u786e\u7684\u4f8b\u5b50\uff1a<code>str()<\/code>\u65b9\u7a0b\u53ef\u4ee5\u5728\u8fde\u63a5\u524d\u4f7f\u6570\u5b57\u8f6c\u53d8\u6210\u5b57\u7b26\u4e32\u3002<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>\u901a\u8fc7\u4f7f\u7528<code>str()\u5c06\u6570\u5b57\u8f6c\u53d8\u6210\u5b57\u7b26\u4e32<\/code><div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 32px;'><textarea wrap='off' name='usercode7' id='usercode7'  cols=10 rows=1 readonly='readonly'  style = 'height : 32px;'  class='pyboxCode RO'>\nprint(\"high \" + str(5))<\/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<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(7)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(7,'N')\" ><\/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=\"daa4e48441b54e974cbdf799ca6e292e\"\/>\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 <\/span><\/td><\/table><\/p>\n<p>\u6b63\u5982\u6211\u4eec\u5728\u7b2c\u56db\u8bfe\u63d0\u5230\u7684\u90a3\u6837\uff0c\u4f60\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u4e0e\u6574\u6570\u76f8\u4e58\uff1a<code>S * n<\/code> \u4ee3\u8868<code>S + S + ... + S<\/code>\u3002<\/p>\n<p><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>\u5b57\u7b26\u4e32\u76f8\u4e58<div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 58px;'><textarea wrap='off' name='usercode8' id='usercode8'  cols=10 rows=2 readonly='readonly'  style = 'height : 58px;'  class='pyboxCode RO'>\nprint(\"hots\" * 2)\nprint(\"mi\"+(\"s\"*2+\"i\")*2+\"ppi\")<\/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<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(8)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(8,'N')\" ><\/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=\"925f6d8d9c2560c5cb1806844f936b21\"\/>\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<\/p>\n<h2>\u5b57\u7b26\u4ee3\u7801\uff1a<code>ord<\/code>, <code>chr<\/code><a name=\"ord\"><\/a><\/h2>\n<p>\u5728\u6211\u4eec\u8fd9\u8282\u8bfe\u7684\u5e8f\u4e2d\u63d0\u5230\u4e86\u8ba1\u7b97\u673a\u5c06\u6bcf\u4e2a\u5b57\u7b26\u7528\u6570\u5b57\u8868\u793a\u3002\u90a3\u4e48\u5230\u5e95\u54ea\u4e00\u4e2a\u6570\u5b57\u4ee3\u8868\u4e86\u54ea\u4e00\u4e2a\u5b57\u7b26\u5462\uff1f\u901a\u5e38\u6765\u8bf4\u53d6\u51b3\u4e8e\u4f60\u7684\u7535\u8111\u4f7f\u7528\u7684<em>\u7f16\u7801<\/em>\uff0c\u4f46\u662f\u73b0\u5728\u51e0\u4e4e\u6240\u6709\u7684\u8ba1\u7b97\u673a\u90fd\u4f7f\u7528\u4e00\u5957\u901a\u7528\u7684\u4ece32\u5230255\u7684\u7f16\u7801\u3002\u4e0b\u9762\u662f\u4e00\u7cfb\u5217\u4ece32\u5230127\u7684\u7f16\u7801\u53ca\u6240\u4ee3\u8868\u7684\u5b57\u7b26\uff1a<\/p>\n<pre>ord: 32 \u00a033 \u00a034 \u00a035 \u00a036 \u00a037 \u00a038 \u00a039 \u00a040 \u00a041 \u00a042 \u00a043 \u00a044 \u00a045 \u00a046 \u00a047\r\nchr: \u00a0 \u00a0 \u00a0! \u00a0 \" \u00a0 # \u00a0 $ \u00a0 % \u00a0 &amp; \u00a0 ' \u00a0 ( \u00a0 ) \u00a0 * \u00a0 + \u00a0 , \u00a0 - \u00a0 . \u00a0 \/\r\nord: 48 \u00a049 \u00a050 \u00a051 \u00a052 \u00a053 \u00a054 \u00a055 \u00a056 \u00a057 \u00a058 \u00a059 \u00a060 \u00a061 \u00a062 \u00a063\r\nchr: \u00a00 \u00a0 1 \u00a0 2 \u00a0 3 \u00a0 4 \u00a0 5 \u00a0 6 \u00a0 7 \u00a0 8 \u00a0 9 \u00a0 : \u00a0 ; \u00a0 &lt; \u00a0 = \u00a0 &gt; \u00a0 ?\r\nord: 64 \u00a065 \u00a066 \u00a067 \u00a068 \u00a069 \u00a070 \u00a071 \u00a072 \u00a073 \u00a074 \u00a075 \u00a076 \u00a077 \u00a078 \u00a079\r\nchr: \u00a0@ \u00a0 A \u00a0 B \u00a0 C \u00a0 D \u00a0 E \u00a0 F \u00a0 G \u00a0 H \u00a0 I \u00a0 J \u00a0 K \u00a0 L \u00a0 M \u00a0 N \u00a0 O\r\nord: 80 \u00a081 \u00a082 \u00a083 \u00a084 \u00a085 \u00a086 \u00a087 \u00a088 \u00a089 \u00a090 \u00a091 \u00a092 \u00a093 \u00a094 \u00a095\r\nchr: \u00a0P \u00a0 Q \u00a0 R \u00a0 S \u00a0 T \u00a0 U \u00a0 V \u00a0 W \u00a0 X \u00a0 Y \u00a0 Z \u00a0 [ \u00a0 \\ \u00a0 ] \u00a0 ^ \u00a0 _\r\nord: 96 \u00a097 \u00a098 \u00a099 \u00a0100 101 102 103 104 105 106 107 108 109 110 111\r\nchr: \u00a0` \u00a0 a \u00a0 b \u00a0 c \u00a0 d \u00a0 e \u00a0 f \u00a0 g \u00a0 h \u00a0 i \u00a0 j \u00a0 k \u00a0 l \u00a0 m \u00a0 n \u00a0 o\r\nord: 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127\r\nchr: \u00a0p \u00a0 q \u00a0 r \u00a0 s \u00a0 t \u00a0 u \u00a0 v \u00a0 w \u00a0 x \u00a0 y \u00a0 z \u00a0 { \u00a0 | \u00a0 } \u00a0 ~<\/pre>\u5728\u4e4b\u540e\u7684\u7b2c\u516b\u8282\u8bfe\u91cc\uff0c\u4f60\u5c06\u7f16\u5199\u4e00\u4e2a\u7a0b\u5e8f\u6765\u5bfc\u51fa\u8fd9\u4e2a\u8868\u3002<br \/>\n\u5c06\u6574\u4e2a\u8868\u90fd\u8bb0\u4f4f\u5176\u5b9e\u6ca1\u6709\u5f88\u5927\u7528\u5904\uff0c\u4f46\u662f\u6709\u4e00\u4e9b\u6570\u636e\u8bb0\u4f4f\u7684\u8bdd\u4f1a\u6709\u5e2e\u52a9\uff1a<\/p>\n<ul>\n<li>\u5c0f\u5199\u5b57\u6bcda, b, c, ..., z\u5b57\u7b26\u4ee3\u7801\u662f\u8fde\u7eed\u7684<\/li>\n<li>\u5927\u5199\u5b57\u6bcdA, B, C, ..., Z\u5b57\u7b26\u4ee3\u7801\u662f\u8fde\u7eed\u7684<\/li>\n<li>\u6570\u5b570, 1, 2, ..., 9\u5b57\u7b26\u4ee3\u7801\u662f\u8fde\u7eed\u7684<\/li>\n<\/ul>\n<p>32\u4ee3\u8868\u7a7a\u683c\uff0c127\u4ee3\u8868\u201c\u63a7\u5236\u201d\u5b57\u7b26\uff08\u6bd4\u8f83\u7279\u6b8a\uff09\u3002\u6709\u4e00\u4e9b\u63a7\u5236\u5b57\u7b26\uff0c\u59829\u4ee3\u8868tab\uff0c10 \u548c13\u4ee3\u8868<a href=\"http:\/\/en.wikipedia.org\/wiki\/Newline\">\u6362\u884c<\/a>.<\/p>\n<p>\u5728 Python \u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4f7f \u7528 ord \u65b9\u7a0b\u5c06\u4e00\u4e2a\u5b57\u7b26\u8f6c\u53d8\u4e3a \u76f8\u5e94\u7684\u6570\u5b57\u7f16\u7801\u3002<code>chr<\/code>\u65b9\u7a0b\u505a\u5f97\u662f\u76f8\u53cd\u7684\u4e8b\u60c5\uff1a\u5c06\u4e00\u4e2a\u6570\u5b57\u8f6c\u53d8\u4e3a\u76f8\u5e94\u7684\u5b57\u7b26\u3002<br \/>\n<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><code>ord<\/code>\u548c<code>chr<\/code>\u7684\u4f8b\u5b50 <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 58px;'><textarea wrap='off' name='usercode9' id='usercode9'  cols=10 rows=2 readonly='readonly'  style = 'height : 58px;'  class='pyboxCode RO'>\nprint(ord('a'), ord('b'), ord('A'), ord('B'), ord(' '))\nprint(chr(35), chr(43), chr(100))<\/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<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(9)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(9,'N')\" ><\/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=\"a351e1806345a8af896f5e992e2af359\"\/>\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<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform10\" method=\"POST\">\n<div class='pybox modeNeutral ' id='pybox10'>\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'>\u4e0b\u4e00\u4e2a\u5b57\u6bcd<\/span><\/div>\u7f16\u5199\u4e00\u4e2a\u7a0b\u5e8f\uff0c\u8f93\u5165\u4e00\u4e2a\u5b57\u7b26\uff08\u957f\u5ea6\u4e3a1\u7684\u5b57\u7b26\u4e32\uff09\uff0c\u5047\u8bbe\u8fd9\u662f\u4e00\u4e2a\u5927\u5199\u7684\u5b57\u7b26\uff1b\u8f93\u51fa\u5e94\u4e3a\u5b57\u6bcd\u8868\u4e2d\u7684\u4e0b\u4e00\u4e2a\u5b57\u7b26\u3002\u5982\u679c\u8f93\u5165\u7684\u662f'Z'\uff0c\u8f93\u51fa\u5e94\u4e3a'A'\u3002\uff08\u9700\u8981\u4f7f\u7528\u5230<code>if<\/code>\u4ece\u53e5\u3002\u8fd8\u6709\u4e00\u4e2a\u63d0\u793a<a class=\"hintlink\"  id=\"hintlink11\">\u70b9\u51fb\u8fd9\u91cc<\/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='usercode10' id='usercode10'  cols=10 rows=20   class='pyboxCode RW'>\n<\/textarea><\/div>\n<div id='pbhistory10' class='flexcontain' style='display:none;'><\/div>\n<div name=\"pyinput\" id=\"pyinput10\">You may enter input for the program in the box below.<div class=\"pyboxTextwrap resizy\" style=\"height: 102px;\" ><textarea wrap=\"off\" name=\"userinput\" class=\"pyboxInput\" cols=10 rows=4><\/textarea><\/div><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit10' value=' '\/><\/td>\n<td><input type='button' name='switch' id=\"switch10\" value=\"Input Switch\" onclick=\"pbInputSwitch(10,'N')\" ><\/td>\n<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(10)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(10,'N')\" ><\/td>\n<\/tr><\/table><select id='pbSelect10' class='selectmore'><option name='more'>More actions...<\/option>\n<option name='history' data-pbonclick=\"historyClick(10,'7a.lowercase')\" >History<\/option>\n<option name='help' data-pbonclick=\"helpClick(10);\" >Help<\/option>\n<\/select><\/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=\"8f85fb42011e645007a344a2207bfcd2\"\/>\n<div id='pbresults10' class='pbresults avoidline'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>jQuery(function(){pbToggleCodeMirror(10);});pbInputSwitch(10,\"N\");<\/script>\n<\/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> \u6709\u4e00\u4e9b\u7cfb\u7edf\u53ea\u652f\u6301\u4ece32\u5230127\u4e4b\u95f4\u53ef\u6253\u5370\u7684\u5b57\u7b26\uff1b\u5176\u4ed6\u7684\u7a0b\u5e8f\u63a5\u53d7\u7684\u53ef\u6253\u5370\u7684\u5b57\u7b26\u53ef\u8fbe255\u621665535\uff1b\u901a\u7528\u7801\u4e2d\u6709\u6210\u5343\u4e0a\u4e07\u4e2a\u5b57\u7b26\u3002<a href=\"http:\/\/en.wikipedia.org\/wiki\/American_Standard_Code_for_Information_Interchange\">here<\/a> or <a href=\"http:\/\/www.joelonsoftware.com\/articles\/Unicode.html\">\u8fd9\u91cc<\/a>\u6709\u66f4\u591a\u5173\u4e8e\u8fd9\u4e2a\u7684\u5386\u53f2\u3002 <\/span><\/td><\/table><\/p>\n<p>\u4e0b\u9762\u662f\u4e24\u4e2a\u7ec3\u4e60\u9898\u3002<\/p>\n<p><form class=\"pbform\" action=\"#\" id=\"pbform12\" method=\"POST\">\n<div class='pybox modeNeutral ' id='pybox12'>\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'>Pig Latin<\/span><\/div><strong>Pig Latin<\/strong>\u662f\u4e00\u79cd\u8bed\u8a00\u3002\u5c06\u82f1\u8bed\u7ffb\u8bd1\u6210Pig Latin\u8bed\uff0c\u4f60\u9700\u8981\u5c06\u7b2c\u4e00\u4e2a\u5b57\u6bcd\u79fb\u5230\u6700\u540e\uff0c\u518d\u52a0\u4e0a\"ay\"\u3002\u6bd4\u5982\uff0c<em>monkey<\/em>\u7ffb\u8bd1\u6210Pig Latin\u5c31\u662f<em>onkeymay<\/em>\uff0c<em>word<\/em>\u5c31\u662f <em>ordway<\/em>\u3002\u7f16\u5199\u4e00\u4e2a\u7a0b\u5e8f\u4f7f\u5c06\u4e00\u4e2a\u5355\u8bcd\u8f6c\u6362\u6210Pig Latin\u8bed\u3002\uff08\u73b0\u5b9e\u4e2d\uff0cPig Latin\u8bed\u7684\u89c4\u5219\u6bd4\u8fd9\u4e2a\u8981\u590d\u6742\u5f97\u591a\uff0c\u4f46\u662f\u5728\u8fd9\u91cc\u6211\u4eec\u5ffd\u7565\u6389\u5176\u4ed6\u89c4\u5219\u3002\uff09<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='usercode12' id='usercode12'  cols=10 rows=20   class='pyboxCode RW'>\n<\/textarea><\/div>\n<div id='pbhistory12' class='flexcontain' style='display:none;'><\/div>\n<div name=\"pyinput\" id=\"pyinput12\">You may enter input for the program in the box below.<div class=\"pyboxTextwrap resizy\" style=\"height: 102px;\" ><textarea wrap=\"off\" name=\"userinput\" class=\"pyboxInput\" cols=10 rows=4><\/textarea><\/div><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit12' value=' '\/><\/td>\n<td><input type='button' name='switch' id=\"switch12\" value=\"Input Switch\" onclick=\"pbInputSwitch(12,'N')\" ><\/td>\n<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(12)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(12,'N')\" ><\/td>\n<\/tr><\/table><select id='pbSelect12' class='selectmore'><option name='more'>More actions...<\/option>\n<option name='history' data-pbonclick=\"historyClick(12,'7a.piglatin')\" >History<\/option>\n<option name='help' data-pbonclick=\"helpClick(12);\" >Help<\/option>\n<\/select><\/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=\"eb161e5a63f66ac0d38ec8929c1985e0\"\/>\n<div id='pbresults12' class='pbresults avoidline'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>jQuery(function(){pbToggleCodeMirror(12);});pbInputSwitch(12,\"N\");<\/script>\n<\/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'>\u540d\u5b57\u6e38\u620f<\/span><\/div><strong>Name Game<\/strong>\u4f1a\u4ee5\u4e00\u4e2a\u4eba\u7684\u540d\u5b57\u4e3a\u57fa\u7840\u7f16\u4e00\u9996\u6b4c\u3002\u8bf7\u542c\u6b4c\u66f2\u6765\u4e86\u89e3\u662f\u600e\u4e48\u4e00\u56de\u4e8b\uff1a<div style='text-align: center;'>\n<iframe width='560' height='315' src='https:\/\/www.youtube.com\/embed\/NeF7jqf0GU4?rel=0' frameborder='0' allowfullscreen>\n<\/iframe>\n<\/div>\u4f60\u7684\u7a0b\u5e8f\u7684\u8f93\u5165\u662f\u4e00\u4e2a\u4eba\u540d\uff0c\u6bd4\u5982\"pearl\"\uff0c\u6253\u5370\u51fa\u6b4c\u66f2\uff1a<\/p>\n<pre>pearl, pearl, bo-bearl\r\nbanana-fana fo-fearl\r\nfee-fi-mo-mearl\r\npearl!<\/pre>\u6ce8\u610f\uff1a\u672a\u6539\u52a8\u7684\u540d\u5b57\u51fa\u73b0\u4e86\u4e09\u6b21\uff1b\u9996\u5b57\u6bcd\u88ab\u6362\u6210b, f, \u6216m\u4e5f\u51fa\u73b0\u4e86\u4e09\u6b21\u3002\uff08\u5b9e\u9645\u4e0a\uff0c\u8fd9\u4e2a\u6b4c\u66f2\u7684\u89c4\u5219\u6bd4\u8fd9\u4e2a\u8981\u590d\u6742\u5f97\u591a\uff0c\u4f46\u662f\u5728\u8fd9\u91cc\u6211\u4eec\u5ffd\u7565\u5176\u4ed6\u89c4\u5219\u3002\uff09<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'>\n<\/textarea><\/div>\n<div id='pbhistory13' class='flexcontain' style='display:none;'><\/div>\n<div name=\"pyinput\" id=\"pyinput13\">You may enter input for the program in the box below.<div class=\"pyboxTextwrap resizy\" style=\"height: 102px;\" ><textarea wrap=\"off\" name=\"userinput\" class=\"pyboxInput\" cols=10 rows=4><\/textarea><\/div><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit13' value=' '\/><\/td>\n<td><input type='button' name='switch' id=\"switch13\" value=\"Input Switch\" onclick=\"pbInputSwitch(13,'N')\" ><\/td>\n<td><input type='button' name='consolecopy' value=\"Open in console\" onclick=\"pbConsoleCopy(13)\" ><\/td>\n<td><input type='button' name='visualize' value=\"Visualize\" onclick=\"pbVisualize(13,'N')\" ><\/td>\n<\/tr><\/table><select id='pbSelect13' class='selectmore'><option name='more'>More actions...<\/option>\n<option name='history' data-pbonclick=\"historyClick(13,'7a.namegame')\" >History<\/option>\n<option name='help' data-pbonclick=\"helpClick(13);\" >Help<\/option>\n<\/select><\/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=\"103d55cb187a734d7e00a21ad38ba26c\"\/>\n<div id='pbresults13' class='pbresults avoidline'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>jQuery(function(){pbToggleCodeMirror(13);});pbInputSwitch(13,\"N\");<\/script>\n<\/p>\n<p><em>\u8be5\u5b66\u4e60\u4e0b\u4e00\u8282\u8bfe\u5566\uff01<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c7\u8282\u8bfe\u6709\u4e09\u4e2a\u90e8\u5206\uff1aA\uff0cB\uff0cC\u3002\u6ca1\u6709\u987a\u5e8f\u3002 \u76ee\u524d\u4e3a\u6b62\uff0c\u6211\u4eec\u53ea\u662f\u7b80\u5355\u7684\u4f7f\u7528\u4e86\u5b57\u7b26\u4e32\uff08\u7c7b\u578b\u662fstr\uff09\u3002\u8fd9\u95e8\u8bfe\u6211\u4eec\u4f1a\u5bf9\u5b57\u7b26\u4e32\u505a\u51fa\u4e00\u4e9b\u5904\u7406\uff1a\u5206\u79bb\u3001\u7ec4\u5408\u5b57\u7b26\uff0c\u67e5\u770b\u5b57\u7b26\u4e32\u4e2d\u5355\u72ec\u7684\u5b57\u7b26\u3002 \u4ec0\u4e48\u662f\u5b57\u7b26\uff1f \u8ba1\u7b97\u673a\u91cc\u7684\u6570\u636e\u57fa\u672c\u4e0a\u90fd\u662f\u4ee5 0 \u548c 1 \u7684\u5e8f\u5217\u5f62\u5f0f\u50a8\u5b58\u7684\uff1a\u6bd4\u5982\u6587\u672c\uff0c\u7535\u5b50\u4e66\uff0c\u56fe\u7247\uff0c\u6b4c\u66f2\uff0c\u89c6\u9891\uff0c\"\u53ef\u6267\u884c\u6587\u4ef6\"\u5982\u6e38\u620f\u548c\u5e94\u7528\u3002\u5b57\u7b26\u4e32\u662f\u4e00\u79cd\u6587\u672c\u6570\u636e\uff0c\u4ee5\u5982\u4e0b\u5f62\u5f0f\u50a8\u5b58\uff1a \u5b57\u7b26\u4e32\u662f\u4e00\u7cfb\u5217\u5b57\u7b26\u7ec4\u6210\u7684\uff08\u6bd4\u5982\uff0c\u5b57\u7b26\u4e32\"Hello, World!\"\u5305\u542b13\u4e2a\u5b57\u7b26\uff0c\u5982\"H\"\uff0c\"e\"\u548c\u6807\u70b9\" \"\uff0c\"!\"\u3002 \u6bcf\u4e2a\u5b57\u7b26\u5b9e\u9645\u4e0a\u7531\u4e00\u4e2a\u6570\u5b57\u8868\u793a\uff08\"H\"\u662f\u753140\u8868\u793a\uff1b\u8fd9\u662f\u7f8e\u56fd\u4fe1\u606f\u4ea4\u6362\u6807\u51c6\u4ee3\u7801\/\u7edf\u4e00\u7801\uff09 \uff08\u6570\u5b57\u662f\u4ee50-1\u4e8c\u8fdb\u5236\u5f62\u5f0f\u50a8\u5b58\u3002\uff09 \u5c06\u5b57\u7b26\u4e32\u770b\u4f5c\u4e3a\u5b57\u7b26\u7684\u5e8f\u5217: S[] \u4e3a\u4e86\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u64cd\u4f5c\uff0c\u6211\u4eec\u9700\u8981\u63d0\u53d6\u51fa\u5b57\u7b26\u4e32\u91cc\u7684\u6bcf\u4e2a\u5b57\u7b26\u3002\u5728Python\u4e2d\uff0c\u8fd9\u662f\u4ee5\u5982\u4e0b\u65b9\u5f0f\u8fdb\u884c\uff1a\u6211\u4eec\u6709\u4e00\u4e2a\u5b57\u7b26\u4e32S\u548c\u4e00\u4e2a\u6574\u6570index\uff0c S[index]\u8fd4\u8fd8\u4e86\u5b57\u7b26\u4e32S\u4e2d\u7684\u7b2cindex\u4f4d\u5b57\u7b26\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u5b57\u7b26\u4e32\u4ee5\u7d22\u5f150\u5f00\u59cb\uff1a\u6240\u4ee5S[0]\u662f\u7b2c\u4e00\u4e2a\u5b57\u7b26\uff0cS[1]\u662f\u7b2c\u4e8c\u4e2a\u5b57\u7b26\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002\u5728\"Hello, World!\"\u4e2d\uff1a \u7d22\u5f15\uff1a0 \u00a01 \u00a02 \u00a03 \u00a04 \u00a05 \u00a06 \u00a07 \u00a08 \u00a09 10 11 12 \u5b57\u7b26: H \u00a0e \u00a0l \u00a0l \u00a0o \u00a0, \u00a0 \u00a0 &hellip; <a href=\"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/zh-7a\/\">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-9235","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/pages\/9235","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=9235"}],"version-history":[{"count":12,"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/pages\/9235\/revisions"}],"predecessor-version":[{"id":10248,"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/pages\/9235\/revisions\/10248"}],"wp:attachment":[{"href":"https:\/\/cscircles.cemc.uwaterloo.ca\/dev\/wp-json\/wp\/v2\/media?parent=9235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}