{"id":204819,"date":"2025-05-29T11:14:22","date_gmt":"2025-05-29T03:14:22","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204819\/"},"modified":"2025-05-29T11:14:22","modified_gmt":"2025-05-29T03:14:22","slug":"python-%e5%87%bd%e6%95%b0%e9%80%92%e5%bd%92%e8%b0%83%e7%94%a8%e6%97%b6%ef%bc%8c%e4%b8%ba%e4%bb%80%e4%b9%88%e7%bc%ba%e5%b0%91-return-%e4%bc%9a%e5%af%bc%e8%87%b4%e6%ad%bb%e5%be%aa%e7%8e%af%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204819\/","title":{"rendered":"Python \u51fd\u6570\u9012\u5f52\u8c03\u7528\u65f6\uff0c\u4e3a\u4ec0\u4e48\u7f3a\u5c11 return \u4f1a\u5bfc\u81f4\u6b7b\u5faa\u73af\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Python \u51fd\u6570\u9012\u5f52\u8c03\u7528\u65f6\uff0c\u4e3a\u4ec0\u4e48\u7f3a\u5c11 return \u4f1a\u5bfc\u81f4\u6b7b\u5faa\u73af\uff1f<\/h1>\n<p>\u672c\u7bc7\u6587\u7ae0\u4e3b\u8981\u662f\u7ed3\u5408\u6211\u4e4b\u524d\u9762\u8bd5\u7684\u5404\u79cd\u7ecf\u5386\u548c\u5b9e\u6218\u5f00\u53d1\u4e2d\u9047\u5230\u7684\u95ee\u9898\u89e3\u51b3\u7ecf\u9a8c\u6574\u7406\u7684\uff0c\u5e0c\u671b\u8fd9\u7bc7\u300aPython \u51fd\u6570\u9012\u5f52\u8c03\u7528\u65f6\uff0c\u4e3a\u4ec0\u4e48\u7f3a\u5c11 return \u4f1a\u5bfc\u81f4\u6b7b\u5faa\u73af\uff1f\u300b\u5bf9\u4f60\u6709\u5f88\u5927\u5e2e\u52a9\uff01\u6b22\u8fce\u6536\u85cf\uff0c\u5206\u4eab\u7ed9\u66f4\u591a\u7684\u9700\u8981\u7684\u670b\u53cb\u5b66\u4e60~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241117\/17318113586739581e5fa2c.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>python\u51fd\u6570\u5728\u5faa\u73af\u4e2d\u8c03\u7528\u81ea\u8eab\u7684\u96be\u9898<\/strong><\/p>\n<p>\u672c\u4f8b\u4e2d\uff0c\u63d0\u4f9b\u7684python\u7a0b\u5e8f\u65e8\u5728\u8ba1\u7b97\u6700\u5927\u516c\u7ea6\u6570\uff08gcd\uff09\uff0c\u4f46\u5728\u8fd0\u884c\u51fd\u6570gcd\u65f6\u9047\u5230\u4e86\u95ee\u9898\u3002<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>a = 666\nb = 1414\n\ndef gcd(x, y):\n    x, y = y, x % y\n    while x % y &gt; 0:\n        gcd(x, y)\n    else:\n        return y\n\nprint(gcd(666, 1414))<\/pre>\n<p>\u95ee\u9898\u5728\u4e8e\uff0c\u5728\u5faa\u73af\u4e2d\u8c03\u7528\u51fd\u6570gcd\u65f6\u7f3a\u5c11return\u3002\u5728\u6ca1\u6709return\u7684\u60c5\u51b5\u4e0b\uff0c\u4ee3\u7801\u9677\u5165\u4e86\u4e00\u4e2a\u6b7b\u5faa\u73af\uff0c\u5bfc\u81f4\u7a0b\u5e8f\u65e0\u6cd5\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p>\u6b63\u786e\u7684\u4fee\u590d\u65b9\u6cd5\u662f\u5728\u5faa\u73af\u4e2d\u6dfb\u52a0return\uff1a<\/p>\n<pre>a = 666\nb = 1414\n\ndef gcd(x, y):\n    x, y = y, x % y\n    while x % y &gt; 0:\n        return gcd(x, y)\n    else:\n        return y\n\nprint(gcd(666, 1414))<\/pre>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300aPython \u51fd\u6570\u9012\u5f52\u8c03\u7528\u65f6\uff0c\u4e3a\u4ec0\u4e48\u7f3a\u5c11 return \u4f1a\u5bfc\u81f4\u6b7b\u5faa\u73af\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u51fd\u6570\u9012\u5f52\u8c03\u7528\u65f6\uff0c\u4e3a&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-204819","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=204819"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204819\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}