{"id":315,"date":"2025-10-10T15:20:20","date_gmt":"2025-10-10T07:20:20","guid":{"rendered":"http:\/\/www.pyteam.cn\/?p=315"},"modified":"2025-10-10T15:20:20","modified_gmt":"2025-10-10T07:20:20","slug":"%e4%bb%bb%e5%8a%a12%ef%bc%9a%e7%bb%98%e5%88%b6%e5%bd%a9%e8%89%b2%e4%b8%89%e8%a7%92%e5%bd%a2%e5%9b%be%e6%a1%88-11-6","status":"publish","type":"post","link":"http:\/\/www.pyteam.cn\/index.php\/2025\/10\/10\/%e4%bb%bb%e5%8a%a12%ef%bc%9a%e7%bb%98%e5%88%b6%e5%bd%a9%e8%89%b2%e4%b8%89%e8%a7%92%e5%bd%a2%e5%9b%be%e6%a1%88-11-6\/","title":{"rendered":"\u4efb\u52a12\uff1a\u7ed8\u5236\u5f69\u8272\u4e09\u89d2\u5f62\u56fe\u6848 11.6"},"content":{"rendered":"\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:clamp(18px, 1.125rem, 27px);font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#90A4AE;--cbp-line-number-width:calc(1 * 0.6 * 1.125rem);line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#ededed;color:#8198a3\">Python<\/span><span role=\"button\" tabindex=\"0\" style=\"color:#90A4AE;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>colors = &#91;\"red\", \"green\", \"blue\", \"purple\", \"orange\"&#93;\n\nfor i in range(36):  # \u7ed8\u523636\u4e2a\u4e09\u89d2\u5f62\uff0c\u56f4\u6210\u4e00\u5708\n    pen.color(colors&#91;i % 5&#93;)  # \u5faa\u73af\u4f7f\u7528\u989c\u8272\u5217\u8868\u4e2d\u7684\u989c\u8272\n    for j in range(3):  # \u7ed8\u5236\u4e00\u4e2a\u4e09\u89d2\u5f62\n        pen.forward(50)\n        pen.right(120)\n    pen.right(10)  # \u6bcf\u4e2a\u4e09\u89d2\u5f62\u4e4b\u95f4\u65cb\u8f6c10\u5ea6<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-lighter\" style=\"background-color: #FAFAFA\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #90A4AE\">colors <\/span><span style=\"color: #39ADB5\">=<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #39ADB5\">&#91;<\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #91B859\">red<\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #39ADB5\">,<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #91B859\">green<\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #39ADB5\">,<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #91B859\">blue<\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #39ADB5\">,<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #91B859\">purple<\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #39ADB5\">,<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #91B859\">orange<\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #39ADB5\">&#93;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #39ADB5; font-style: italic\">for<\/span><span style=\"color: #90A4AE\"> i <\/span><span style=\"color: #39ADB5; font-style: italic\">in<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #6182B8\">range<\/span><span style=\"color: #39ADB5\">(<\/span><span style=\"color: #F76D47\">36<\/span><span style=\"color: #39ADB5\">):<\/span><span style=\"color: #90A4AE\">  <\/span><span style=\"color: #90A4AE; font-style: italic\"># \u7ed8\u523636\u4e2a\u4e09\u89d2\u5f62\uff0c\u56f4\u6210\u4e00\u5708<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">    pen<\/span><span style=\"color: #39ADB5\">.<\/span><span style=\"color: #6182B8\">color<\/span><span style=\"color: #39ADB5\">(<\/span><span style=\"color: #6182B8\">colors<\/span><span style=\"color: #39ADB5\">&#91;<\/span><span style=\"color: #6182B8\">i <\/span><span style=\"color: #39ADB5\">%<\/span><span style=\"color: #6182B8\"> <\/span><span style=\"color: #F76D47\">5<\/span><span style=\"color: #39ADB5\">&#93;)<\/span><span style=\"color: #90A4AE\">  <\/span><span style=\"color: #90A4AE; font-style: italic\"># \u5faa\u73af\u4f7f\u7528\u989c\u8272\u5217\u8868\u4e2d\u7684\u989c\u8272<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">    <\/span><span style=\"color: #39ADB5; font-style: italic\">for<\/span><span style=\"color: #90A4AE\"> j <\/span><span style=\"color: #39ADB5; font-style: italic\">in<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #6182B8\">range<\/span><span style=\"color: #39ADB5\">(<\/span><span style=\"color: #F76D47\">3<\/span><span style=\"color: #39ADB5\">):<\/span><span style=\"color: #90A4AE\">  <\/span><span style=\"color: #90A4AE; font-style: italic\"># \u7ed8\u5236\u4e00\u4e2a\u4e09\u89d2\u5f62<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">        pen<\/span><span style=\"color: #39ADB5\">.<\/span><span style=\"color: #6182B8\">forward<\/span><span style=\"color: #39ADB5\">(<\/span><span style=\"color: #F76D47\">50<\/span><span style=\"color: #39ADB5\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">        pen<\/span><span style=\"color: #39ADB5\">.<\/span><span style=\"color: #6182B8\">right<\/span><span style=\"color: #39ADB5\">(<\/span><span style=\"color: #F76D47\">120<\/span><span style=\"color: #39ADB5\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">    pen<\/span><span style=\"color: #39ADB5\">.<\/span><span style=\"color: #6182B8\">right<\/span><span style=\"color: #39ADB5\">(<\/span><span style=\"color: #F76D47\">10<\/span><span style=\"color: #39ADB5\">)<\/span><span style=\"color: #90A4AE\">  <\/span><span style=\"color: #90A4AE; font-style: italic\"># \u6bcf\u4e2a\u4e09\u89d2\u5f62\u4e4b\u95f4\u65cb\u8f6c10\u5ea6<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":79,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,5],"tags":[],"class_list":["post-315","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-20","category-5"],"views":191,"_links":{"self":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/comments?post=315"}],"version-history":[{"count":1,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/315\/revisions"}],"predecessor-version":[{"id":316,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/315\/revisions\/316"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/media\/79"}],"wp:attachment":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/media?parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/categories?post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/tags?post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}