{"id":7331,"date":"2021-03-19T03:24:17","date_gmt":"2021-03-19T02:24:17","guid":{"rendered":"https:\/\/myoceane.fr\/?p=7331"},"modified":"2021-03-19T16:14:11","modified_gmt":"2021-03-19T15:14:11","slug":"python-functions","status":"publish","type":"post","link":"https:\/\/myoceane.fr\/index.php\/python-functions\/","title":{"rendered":"[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<h3>Python Data Types \u8cc7\u6599\u985e\u578b &#8211; Functions \u51fd\u6578<\/h3>\n<table style=\"border-collapse: collapse; width: 100%; height: 197px;\">\n<tbody>\n<tr style=\"height: 20px;\">\n<td style=\"width: 4.71628%; height: 20px;\">\n<h5>No.<\/h5>\n<\/td>\n<td style=\"width: 19.5036%; height: 20px;\">\n<h5>Functions \u51fd\u6578\u7528\u6cd5<\/h5>\n<\/td>\n<td style=\"width: 75.7801%; height: 20px;\">\n<h5>\u8a3b<\/h5>\n<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 4.71628%; height: 20px;\">1<\/td>\n<td style=\"width: 19.5036%; height: 20px;\"><a href=\"#def\">\u5b9a\u7fa9\u51fd\u6578<\/a><\/td>\n<td style=\"width: 75.7801%; height: 20px;\">\u5229\u7528 <span style=\"color: #ff0000;\">def<\/span> \u5b9a\u7fa9 <span style=\"color: #ff0000;\">my_function ( ) :<\/span><\/td>\n<\/tr>\n<tr style=\"height: 57px;\">\n<td style=\"width: 4.71628%; height: 57px;\">2<\/td>\n<td style=\"width: 19.5036%; height: 57px;\"><a href=\"#arguments\">\u6307\u5b9a\u53c3\u6578\uff08arguments<\/a>\uff09<\/td>\n<td style=\"width: 75.7801%; height: 57px;\">\u5728 my_function<span style=\"color: #ff0000;\"> ()<\/span> \u5c0f\u62ec\u865f\u5167\u7684<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578<\/span>\u53ef\u4ee5\u662f\u4e00\u500b\u6216\u591a\u500b<br \/>\n1) <a href=\"#argu1\">\u5b9a\u7fa9 my_function <span style=\"color: #ff0000;\">() <\/span>\u4e2d\u7684<span style=\"color: #ff0000;\">\u5c0f\u62ec\u865f<\/span>\u5167<\/a><span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 argument<br \/>\n<span style=\"color: #000000;\">2) <a href=\"#argu2\">\u5b9a\u7fa9 my_function () \u4e2d\u7684\u5c0f\u62ec\u865f\u5167<\/a><\/span>\u591a\u500b<span style=\"color: #000000;\">\u6307\u5b9a\u53c3\u6578<br \/>\n3) <a href=\"#argu3\">\u7576\u4e0d\u77e5\u9053\u6709\u5e7e\u500b\u6307\u5b9a\u53c3\u6578\u6642\uff0c\u5728\u6307\u5b9a\u53c3\u6578\u524d\u52a0\u4e0a\u4e00\u500b\u661f\u865f <strong>* \uff0c<\/strong>\u518d\u4f7f\u7528<span style=\"color: #008000;\">\u4f4d\u7f6e [ ] <\/span>\u8868\u793a\u5c07\u5e36\u5165\u7684\u53c3\u6578\u4f4d\u7f6e<\/a><br \/>\n4) <a href=\"#argu4\">\u7576\u56fa\u5b9a key \u7b49\u65bc value\uff08<span style=\"color: #008000;\">key = value<\/span>\uff09\uff0c\u5247\u4e0d\u9700\u8981\u6709\u4f4d\u7f6e\u8cc7\u8a0a<\/a><br \/>\n5) <a href=\"#argu5\">\u7576\u4e0d\u77e5\u9053\u6709\u5e7e\u500b\u6307\u5b9a\u53c3\u6578\u6642\uff0c\u5728\u6307\u5b9a\u53c3\u6578\u524d\u52a0\u4e0a\u5169\u500b\u661f\u865f <strong>** \uff0c<\/strong>\u518d\u4f7f\u7528 <span style=\"color: #008000;\">key = value\u00a0<\/span>\u8868\u793a\u5c07\u5e36\u5165\u7684\u53c3\u6578\u7684 <span style=\"color: #008000;\">key<\/span><\/a><\/span><\/span><\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 4.71628%; height: 20px;\">3<\/td>\n<td style=\"width: 19.5036%; height: 20px;\"><a href=\"#default\">\u9ed8\u8a8d\u53c3\u6578\u503c Default<\/a><\/td>\n<td style=\"width: 75.7801%; height: 20px;\">\u5b9a\u7fa9 my_function <span style=\"color: #ff0000;\">() <span style=\"color: #000000;\">\u7684<\/span><span style=\"color: #008000;\">\u9ed8\u8a8d\u53c3\u6578\u503c<\/span><span style=\"color: #000000;\">\u6642<\/span><\/span><span style=\"color: #ff0000;\">\u5c0f\u62ec\u865f<\/span>\u5167\u7684\u00a0<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 Area<span style=\"color: #000000;\"><span style=\"color: #008000;\"> \u7b49\u65bc &#8221; &#8221; <\/span>\uff08\u8868\u793a\u65bc\u96d9\u5f15\u865f\u5167\uff09<\/span><\/span><\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 4.71628%; height: 20px;\">4<\/td>\n<td style=\"width: 19.5036%; height: 20px;\"><a href=\"#forin\">\u5c07\u5217\u8868\u4f5c\u70ba\u53c3\u6578\u5448\u73fe<\/a><\/td>\n<td style=\"width: 75.7801%; height: 20px;\">\u4f7f\u7528\u8ff4\u5708 <span style=\"color: #ff0000;\">for&#8230;in<\/span><\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 4.71628%; height: 20px;\">5<\/td>\n<td style=\"width: 19.5036%; height: 20px;\"><a href=\"#return\">\u56de\u50b3\u6578\u503c<\/a><\/td>\n<td style=\"width: 75.7801%; height: 20px;\">\u4f7f\u7528 <span style=\"color: #ff0000;\">return<\/span><\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 4.71628%; height: 20px;\">6<\/td>\n<td style=\"width: 19.5036%; height: 20px;\"><a href=\"#pass\">\u7576\u51fd\u6578\u5b9a\u7fa9\u70ba\u7a7a\u767d\u6642<\/a><\/td>\n<td style=\"width: 75.7801%; height: 20px;\">\u51fd\u6578\u5b9a\u7fa9\u4e0d\u80fd\u70ba\u7a7a\u767d\uff0c\u4f46\u57fa\u65bc\u67d0\u7a2e\u539f\u56e0\u800c\u9700\u4e00\u500b\u4e0d\u5e36\u4efb\u4f55\u5167\u5bb9\u7684\u51fd\u6578\u5b9a\u7fa9\uff0c\u8acb\u653e\u5165<span style=\"color: #ff0000;\">pass<\/span>\uff0c\u4ee5\u907f\u514d\u51fa\u932f<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 4.71628%; height: 20px;\">7<\/td>\n<td style=\"width: 19.5036%; height: 20px;\"><a href=\"#recursion\">\u905e\u8ff4 Recursion<\/a><\/td>\n<td style=\"width: 75.7801%; height: 20px;\">\u9700\u6709 1) \u81ea\u6211\u547c\u559a\u30012) \u7d42\u6b62\u689d\u4ef6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><\/h3>\n<h3>1. <a id=\"def\"><\/a>\u5b9a\u7fa9\u51fd\u6578\uff1a\u5229\u7528 <span style=\"color: #ff0000;\">def<\/span> \u5b9a\u7fa9 <span style=\"color: #ff0000;\">my_function ( ) :<\/span><\/h3>\n<pre class=\"lang:python\">def my_function():\n  print(\"Hello from cute Oceane\")\n\nmy_function()<\/pre>\n<pre class=\"lang:python\">Hello from cute Oceane<\/pre>\n<p># \u7528 <span style=\"color: #ff0000;\">def<\/span> \u5b9a\u7fa9 <span style=\"color: #ff0000;\">my_function ( ) :<\/span> \u6211\u7684\u51fd\u6578\uff08my_function \u9700\u52a0<span style=\"color: #ff0000;\">\u5c0f\u62ec\u865f<\/span>\u548c<span style=\"color: #ff0000;\">\u5192\u865f<\/span>\uff09\uff0c\u518d print \u51fa\u5c0f\u62ec\u865f\u5167\u7684\u5b57\uff1a Hello from cute Oceane\uff0c\u7d50\u679c my_function ( ) \u5247\u5f97\u5230\u5c0f\u62ec\u5f27\u865f\u7684\u5b57\uff1aHello from cute Oceane\u3002<\/p>\n<p>my_function() \u5373\u4ee3\u8868\u4ee5\u4e0b\u5169\u7a2e\u52d5\u4f5c\u52a0\u8d77\u4f86\uff1a<br \/>\n1) <span style=\"color: #ff0000;\">def<\/span> \u5b9a\u7fa9 <span style=\"color: #ff0000;\">my_function ():<\/span> \u6211\u7684\u51fd\u6578<br \/>\n2) <span style=\"color: #ff0000;\">print<\/span> \u51fa<span style=\"color: #ff0000;\">\u5c0f\u62ec\u5f27\u5167\u7684\u5b57<\/span><\/p>\n<h3><\/h3>\n<h3>2. <a id=\"arguments\"><\/a>\u6307\u5b9a\u53c3\u6578\uff08arguments\uff09\uff1a\u5728 my_function<span style=\"color: #ff0000;\"> ()<\/span> \u5c0f\u62ec\u865f\u5167\u7684<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578<\/span>\u53ef\u4ee5\u662f\u4e00\u500b\u6216\u591a\u500b\u3002<\/h3>\n<h5><\/h5>\n<h5>1) <a id=\"argu1\"><\/a>\u5b9a\u7fa9 my_function <span style=\"color: #ff0000;\">() <\/span>\u4e2d\u7684<span style=\"color: #ff0000;\">\u5c0f\u62ec\u865f<\/span>\u5167<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 argument<\/span><\/h5>\n<pre class=\"lang:python\">def my_function(argument):\n  print(argument + \" Oceane\")\n\nmy_function(\"cute\")\nmy_function(\"adorable\")\nmy_function(\"joyful\")<\/pre>\n<pre class=\"lang:python\">cute Oceane\nadorable Oceane\njoyful Oceane<\/pre>\n<p># Print \u7d50\u679c\u6642\u5448\u73fe 1) <span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 argument<\/span> \u52a0\u4e0a 2) <span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578 &#8221;\u00a0 Oceane &#8220;\uff08\u8868\u793a\u65bc\u96d9\u5f15\u865f\u5167\uff09<\/span>\uff0c<br \/>\n\u7d50\u679c\u6703\u986f\u793a\uff1a<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578<\/span>\uff08\u96a8\u53c3\u6578\u6539\u8b8a\u800c\u6539\u8b8a\uff09 + <span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578 Oceane<\/span>\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<br \/>\nmy_function ( &#8221; <span style=\"color: #ff0000;\">cute<\/span> &#8221; )\uff1a\u5247\u5448\u73fe <span style=\"color: #ff0000;\">cute<\/span> +<span style=\"color: #0000ff;\"> Oceane<\/span> = <span style=\"color: #ff0000;\">cute<\/span> <span style=\"color: #0000ff;\">Oceane\u00a0<\/span><br \/>\nmy_function ( &#8221; <span style=\"color: #ff0000;\">adorable<\/span> &#8221; )\uff1a\u5247\u5448\u73fe <span style=\"color: #ff0000;\">adorable<\/span> + <span style=\"color: #0000ff;\">Oceane<\/span> = <span style=\"color: #ff0000;\">adorable<\/span> <span style=\"color: #0000ff;\">Oceane\u00a0<\/span><br \/>\nmy_function ( &#8221; <span style=\"color: #ff0000;\">joyful<\/span> &#8221; )\uff1a\u5247\u5448\u73fe <span style=\"color: #ff0000;\">joyful<\/span> + <span style=\"color: #0000ff;\">Oceane<\/span> = <span style=\"color: #ff0000;\">joyful<\/span> <span style=\"color: #0000ff;\">Oceane<\/span><\/p>\n<h5>2) <a id=\"argu2\"><\/a>\u5b9a\u7fa9 my_function <span style=\"color: #ff0000;\">() <\/span>\u4e2d\u7684<span style=\"color: #ff0000;\">\u5c0f\u62ec\u865f<\/span>\u5167<span style=\"color: #ff0000;\">\u591a\u500b<\/span>\u6307\u5b9a\u53c3\u6578<\/h5>\n<p>\u7576\u6709\u5169\u500b\u6307\u5b9a\u53c3\u6578\u6642\uff1a<\/p>\n<pre class=\"lang:python\">def my_function(argument1, argument2):\n  print(argument1 + \" \" + argument2)\n\nmy_function(\"Cute\", \"Oceane\")<\/pre>\n<pre class=\"lang:python\">Cute Oceane<\/pre>\n<p># \u5982\u5b9a\u7fa9\u5169\u500b <span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 argument1<span style=\"color: #000000;\"> \u548c<\/span> argument2<span style=\"color: #000000;\">\uff0c<\/span><\/span>Print \u7d50\u679c\u6642\u5448\u73fe 1) <span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 argument1<\/span> \u52a0\u4e0a 2) <span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578 &#8221;\u00a0 &#8221; \uff08\u8868\u793a\u65bc\u96d9\u5f15\u865f\u5167\uff09<\/span>\u518d\u52a0\u4e0a 3) <span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 argument2<\/span><br \/>\n\u7d50\u679c\u6703\u986f\u793a\uff1a<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578<\/span>\uff08\u96a8\u53c3\u6578\u6539\u8b8a\u800c\u6539\u8b8a\uff09 + <span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578 &#8221; &#8220;\uff08\u7a7a\u683c\uff09 + <span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578<\/span><\/span>\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<br \/>\nmy_function ( &#8221; <span style=\"color: #ff0000;\">Cute<\/span> &#8221; , &#8221; Oceane &#8220;)\uff1a\u5247\u5448\u73fe <span style=\"color: #ff0000;\">Cute<\/span> + <span style=\"color: #0000ff;\">\u7a7a\u683c<\/span> +<span style=\"color: #0000ff;\">\u00a0<span style=\"color: #ff0000;\">Oceane<\/span><\/span> = <span style=\"color: #ff0000;\">Cute<\/span> <span style=\"color: #0000ff;\"><span style=\"color: #ff0000;\">Oceane<\/span>\u00a0<\/span><\/p>\n<h5>3) <a id=\"argu3\"><\/a>\u7576\u4e0d\u77e5\u9053\u6709\u5e7e\u500b\u6307\u5b9a\u53c3\u6578\u6642\uff0c\u5728<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578<\/span>\u524d\u52a0\u4e0a<span style=\"color: #ff0000;\">\u4e00<\/span>\u500b\u661f\u865f <span style=\"color: #ff0000;\"><strong>*<span style=\"color: #000000;\"> \uff0c<\/span><\/strong><\/span>\u518d\u4f7f\u7528<span style=\"color: #008000;\">\u4f4d\u7f6e [ ] <\/span>\u8868\u793a\u5c07\u5e36\u5165\u7684\u53c3\u6578\u4f4d\u7f6e\uff1a<\/h5>\n<pre class=\"lang:python\">def my_function(*babies):\n  print(\"The cutest baby is \" + babies [2])\n\nmy_function(\"Nathalie\", \"Emma\", \"Oceane\", \"Mia\", \"Linda\")<\/pre>\n<pre class=\"lang:python\">The cutest baby is Oceane<\/pre>\n<p># \u7576\u4e0d\u77e5\u9053\u6709\u5e7e\u500b\u6307\u5b9a\u53c3\u6578\uff0c\u5b9a\u7fa9 my_function <span style=\"color: #ff0000;\">() <span style=\"color: #000000;\">\u6642\uff0c<\/span><\/span><span style=\"color: #ff0000;\">\u5c0f\u62ec\u865f<\/span>\u5167\u7684\u00a0<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 babies<span style=\"color: #000000;\"> \u9700\u52a0\u4e0a\u661f\u865f <span style=\"color: #ff0000;\"><strong>*<\/strong><\/span><\/span><\/span>\u00a0\uff0c<br \/>\nPrint \u7d50\u679c\u6642\u5448\u73fe 1) <span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578 &#8221;\u00a0 &#8221; \uff08\u8868\u793a\u65bc\u96d9\u5f15\u865f\u5167\uff09<\/span>\u518d\u52a0\u4e0a 2) \u4f4d\u65bc<span style=\"color: #008000;\">\u4f4d\u7f6e 2<\/span> \u7684<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 babies<span style=\"color: #008000;\"> [ 2 ]<\/span><\/span><br \/>\n\u7d50\u679c\u6703\u986f\u793a\uff1a<span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578 &#8221; The cutest baby is\u00a0 &#8220;<span style=\"color: #000000;\"> + <span style=\"color: #008000;\">\u4f4d\u7f6e 2<\/span> \u7684<\/span><span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 babies<span style=\"color: #008000;\"> [ 2 ]<\/span><\/span><\/span>\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<br \/>\nmy_function ( &#8220;Nathalie&#8221;, &#8220;Emma&#8221;, &#8220;<span style=\"color: #008000;\">Oceane<\/span>&#8220;, &#8220;Mia&#8221;, &#8220;Linda&#8221;)<span style=\"color: #0000ff;\"><span style=\"color: #ff0000;\"><span style=\"color: #000000;\">\uff08\u4f4d\u7f6e\u4f9d\u5e8f\u70ba\uff1a\u4f4d\u7f6e0\uff0c\u4f4d\u7f6e1\uff0c<span style=\"color: #008000;\">\u4f4d\u7f6e2<\/span>\uff0c\u4f4d\u7f6e3\uff0c\u4f4d\u7f6e4\uff09<\/span><\/span><\/span>\uff1a\u5247\u5448\u73fe <span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578 &#8221; The cutest baby is\u00a0 &#8220;<span style=\"color: #000000;\"> + <span style=\"color: #008000;\">\u4f4d\u7f6e 2<\/span> \u7684<\/span><span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578<span style=\"color: #008000;\">\u00a0<\/span><\/span><\/span><span style=\"color: #0000ff;\"><span style=\"color: #008000;\">Oceane<span style=\"color: #000000;\">\uff0c\u7d50\u679c\u70ba\uff1a The cutest baby is Oceane\u3002<\/span><\/span><\/span><\/p>\n<h5>4) <a id=\"argu4\"><\/a>\u7576\u56fa\u5b9a key \u7b49\u65bc value\uff08<span style=\"color: #008000;\">key = value<\/span>\uff09\uff0c\u5247\u4e0d\u9700\u8981\u6709\u4f4d\u7f6e\u8cc7\u8a0a\uff1a<\/h5>\n<pre class=\"lang:python\">def my_function(baby2, baby1, baby3):\n  print(\"The cutest baby is \" + baby1)\n\nmy_function(baby1 = \"Oceane\", baby3 = \"Mia\", baby2 = \"Emma\")<\/pre>\n<pre class=\"lang:python\">The cutest baby is Oceane<\/pre>\n<p># \u5982\u56fa\u5b9a<br \/>\n<span style=\"color: #008000;\">key = value<\/span> \u70ba\uff1a<br \/>\n<span style=\"color: #008000;\">baby1 = Oceane<\/span><br \/>\n<span style=\"color: #008000;\">baby2 = Emma<\/span><br \/>\n<span style=\"color: #008000;\">baby3 = Mia<\/span><br \/>\n\u5176\u64fa\u653e\u7684\u4f4d\u7f6e\u5247\u7121\u56fa\u5b9a\u3002<br \/>\n\u7d50\u679c\u70ba\uff1a<span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578 &#8221; The cutest baby is\u00a0 &#8220;<span style=\"color: #000000;\"> +\u00a0 <span style=\"color: #008000;\">baby2 =<\/span>\u00a0&#8221; <\/span><\/span><span style=\"color: #0000ff;\"><span style=\"color: #008000;\">Oceane<span style=\"color: #000000;\"> &#8221; =<\/span> <span style=\"color: #0000ff;\">The cutest baby is<\/span> Oceane<span style=\"color: #000000;\">\u3002<\/span><\/span><\/span><\/p>\n<h5>5) <a id=\"argu5\"><\/a>\u7576\u4e0d\u77e5\u9053\u6709\u5e7e\u500b\u6307\u5b9a\u53c3\u6578\u6642\uff0c\u5728<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578<\/span>\u524d\u52a0\u4e0a\u5169\u500b\u661f\u865f <span style=\"color: #ff0000;\"><strong>**<span style=\"color: #000000;\"> \uff0c<\/span><\/strong><\/span>\u518d\u4f7f\u7528 <span style=\"color: #008000;\">key = value\u00a0<\/span>\u8868\u793a\u5c07\u5e36\u5165\u7684\u53c3\u6578\u7684 <span style=\"color: #008000;\">key<\/span>\uff1a<\/h5>\n<pre class=\"lang:python\">def my_function(**babies):\n  print(\"The cutest baby is \" + babies [\"arg3\"])\n\nmy_function(arg1 = \"Nathalie\", arg2 = \"Emma\", arg3 = \"Oceane\", arg4 = \"Mia\", arg5 = \"Linda\")<\/pre>\n<pre class=\"lang:python\">The cutest baby is Oceane<\/pre>\n<p># \u7576\u4e0d\u77e5\u9053\u6709\u5e7e\u500b\u6307\u5b9a\u53c3\u6578\uff0c\u5b9a\u7fa9 my_function <span style=\"color: #ff0000;\">() <span style=\"color: #000000;\">\u6642\uff0c<\/span><\/span><span style=\"color: #ff0000;\">\u5c0f\u62ec\u865f<\/span>\u5167\u7684\u00a0<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 babies<span style=\"color: #000000;\"> \u9700\u52a0\u4e0a<span style=\"color: #ff0000;\">\u5169<\/span>\u500b\u661f\u865f <span style=\"color: #ff0000;\"><strong>**<\/strong><\/span><\/span><\/span>\u00a0\uff0c<br \/>\nPrint \u7d50\u679c\u6642\u5448\u73fe 1) <span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578 &#8221;\u00a0 &#8221; \uff08\u8868\u793a\u65bc\u96d9\u5f15\u865f\u5167\uff09<\/span>\u518d\u52a0\u4e0a 2) \u5c07\u5e36\u5165\u53c3\u6578\u7684 <span style=\"color: #008000;\">key<\/span><span style=\"color: #008000;\"> \u81f3\u00a0<\/span><span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 babies<\/span> [ &#8220;<span style=\"color: #ff0000;\"><span style=\"color: #008000;\"> key<\/span><\/span> &#8221; ]<\/p>\n<p>\u518d\u56fa\u5b9a<br \/>\n<span style=\"color: #008000;\">key = value<\/span> \u70ba\uff1a<br \/>\n<span style=\"color: #008000;\">arg1 = Nathalie<\/span><br \/>\n<span style=\"color: #008000;\">arg2 = Emma<\/span><br \/>\n<span style=\"color: #008000;\">arg3 = Oceane<\/span><br \/>\n<span style=\"color: #008000;\">arg4 = Mia<\/span><br \/>\n<span style=\"color: #008000;\">arg5 = Linda<\/span><\/p>\n<p>\u7d50\u679c\u6703\u986f\u793a\uff1a<span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578 &#8221; The cutest baby is\u00a0 &#8220;<span style=\"color: #000000;\"> + <span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 babies<\/span><\/span><\/span> [ &#8220;<span style=\"color: #0000ff;\"><span style=\"color: #000000;\"><span style=\"color: #ff0000;\"><span style=\"color: #008000;\"> arg3<\/span><\/span><\/span><\/span> &#8221; ]<span style=\"color: #0000ff;\"><span style=\"color: #000000;\"><span style=\"color: #ff0000;\"><span style=\"color: #008000;\"><span style=\"color: #000000;\">\uff0c\u7d50\u679c\u70ba<\/span> <span style=\"color: #0000ff;\">The cutest baby is <\/span>Oceane<\/span><\/span><\/span><\/span>\u3002<\/p>\n<h3><\/h3>\n<h3>3. <a id=\"default\"><\/a>\u9ed8\u8a8d\u53c3\u6578\u503c Default Parameter Value\uff1a<\/h3>\n<h5>\u5b9a\u7fa9 my_function <span style=\"color: #ff0000;\">() <span style=\"color: #000000;\">\u7684<\/span><span style=\"color: #008000;\">\u9ed8\u8a8d\u53c3\u6578\u503c<\/span><span style=\"color: #000000;\">\u6642<\/span><\/span><span style=\"color: #ff0000;\">\u5c0f\u62ec\u865f<\/span>\u5167\u7684\u00a0<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 Area<span style=\"color: #000000;\"><span style=\"color: #008000;\"> \u7b49\u65bc &#8221; &#8221; <\/span>\uff08\u8868\u793a\u65bc\u96d9\u5f15\u865f\u5167\uff09<\/span><\/span><\/h5>\n<pre class=\"lang:python\">def my_function(Area = \"Taiwan\"):\n  print(\"Oceane is from \" + Area)\n\nmy_function(\"France\")\nmy_function(\"Asia\")\nmy_function()\nmy_function(\"Europe\")<\/pre>\n<pre class=\"lang:python\">Oceane is from France\nOceane is from Asia\nOceane is from Taiwan\nOceane is from Europe<\/pre>\n<p># \u5b9a\u7fa9 my_function <span style=\"color: #ff0000;\">() <span style=\"color: #000000;\">\u7684<\/span><span style=\"color: #008000;\">\u9ed8\u8a8d\u53c3\u6578\u503c<\/span><span style=\"color: #000000;\">\u6642\uff0c<\/span><\/span><span style=\"color: #ff0000;\">\u5c0f\u62ec\u865f<\/span>\u5167\u7684\u00a0<span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 Area<span style=\"color: #000000;\"><span style=\"color: #008000;\"> \u7b49\u65bc &#8220;Taiwan&#8221; <\/span>\uff08<span style=\"color: #ff0000;\">\u8868\u793a\u65bc\u96d9\u5f15\u865f\u5167<\/span>\uff09<\/span><\/span>\u00a0\u3002<br \/>\nPrint <span style=\"color: #0000ff;\">\u56fa\u5b9a\u53c3\u6578<\/span> &#8220;<span style=\"color: #0000ff;\">Oceane is from<\/span> &#8221; + <span style=\"color: #ff0000;\">\u6307\u5b9a\u53c3\u6578 Area<\/span> \u7d50\u679c\u70ba\uff1a<br \/>\n1. \u5047\u5982\u51fa\u73fe my_function(&#8220;<span style=\"color: #ff0000;\">France<\/span>&#8220;)\uff0c\u5247\u7d50\u679c\u70ba\uff1a Oceane is from <span style=\"color: #ff0000;\">France<\/span>\u3002<br \/>\n2. \u5047\u5982\u51fa\u73fe my_function(&#8220;<span style=\"color: #ff0000;\">Asia<\/span>&#8220;)\uff0c\u5247\u7d50\u679c\u70ba\uff1a Oceane is from <span style=\"color: #ff0000;\">Asia<\/span>\u3002<br \/>\n3. \u5047\u5982\u51fa\u73fe my_function()\uff0c\u62ec\u865f\u4e2d\u70ba\u7a7a\u767d\uff0c\u5247\u7d50\u679c\u6703\u4f7f\u7528<span style=\"color: #008000;\">\u9ed8\u8a8d\u53c3\u6578\u503c<\/span>\u70ba\uff1a Oceane is from <span style=\"color: #008000;\">Taiwan<\/span>\u3002<br \/>\n4. \u5047\u5982\u51fa\u73fe my_function(&#8220;<span style=\"color: #ff0000;\">Europe<\/span>&#8220;)\uff0c\u5247\u7d50\u679c\u70ba\uff1a Oceane is from <span style=\"color: #ff0000;\">Europe<\/span>\u3002<\/p>\n<h3><\/h3>\n<h3>4. <a id=\"forin\"><\/a>\u5c07\u5217\u8868\u4f5c\u70ba\u53c3\u6578\u5448\u73fe\uff1a\u4f7f\u7528\u8ff4\u5708 <span style=\"color: #ff0000;\">for&#8230;in<\/span><\/h3>\n<pre class=\"lang:python\">def my_function(fruit):\n  for x in fruit:\n    print(x)\n\ndeliciousfruits = [\"peach\", \"guava\", \"strawberry\"]\n\nmy_function(deliciousfruits)<\/pre>\n<pre class=\"lang:python\">peach\nguava\nstrawberry<\/pre>\n<p># \u5b9a\u7fa9 my_function(fruit)\uff0c\u5229\u7528\u8ff4\u5708 <span style=\"color: #ff0000;\">for&#8230; in<\/span> \uff0c\u5247\u53ef\u5c07 <span style=\"color: #3366ff;\">x<\/span> \u4e2d\u7684\u5b57\u4e00\u4e00\u5e36\u5165 <span style=\"color: #008000;\">fruit<\/span> \u518d print \u51fa\u4f86\u3002\u7576\u00a0<span style=\"color: #3366ff;\">deliciousfruits<\/span> \u7b49\u65bc &#8220;<span style=\"color: #3366ff;\">peach<\/span>&#8220;\uff0c&#8221;<span style=\"color: #3366ff;\">guava<\/span>&#8220;\uff0c&#8221;<span style=\"color: #3366ff;\">strawberry<\/span>&#8220;\uff0c\u5206\u5225\u5e36\u5165 my_function(<span style=\"color: #3366ff;\">deliciousfruits<\/span>)\uff0c\u5247 print \u51fa\u4f86\u7684\u7d50\u679c\u5206\u5225\u70ba\uff1a peach\u3001guava\u3001strawberry\u3002<\/p>\n<h3><\/h3>\n<h3>5. <a id=\"return\"><\/a>\u56de\u50b3\u6578\u503c\uff1a\u4f7f\u7528 <span style=\"color: #ff0000;\">return<\/span><\/h3>\n<pre class=\"lang:python\">def my_function(x):\n  return 5 * x\n\nprint(my_function(2))\nprint(my_function(4))\nprint(my_function(6))<\/pre>\n<pre class=\"lang:python\">10\n20\n30<\/pre>\n<p>#\u5b9a\u7fa9 my_function(<span style=\"color: #008000;\">x<\/span>)\uff0c\u518d\u4f7f\u7528 <span style=\"color: #ff0000;\">return<\/span> \u56de\u50b3 <span style=\"color: #ff0000;\">5 \u4e58\u4ee5<\/span> <span style=\"color: #008000;\">x<\/span> \u7684\u7d50\u679c\u3002<br \/>\n\u7576 print (my_function(<span style=\"color: #008000;\">2<\/span>)) \u6642\uff0c\u5247 <span style=\"color: #ff0000;\">return<\/span> \u56de <span style=\"color: #ff0000;\">5 \u4e58\u4ee5<\/span> <span style=\"color: #008000;\">2<\/span> \uff0c\u5f97\u5230\u7d50\u679c\u70ba <span style=\"color: #3366ff;\">10<\/span>\u3002<br \/>\n\u7576 print (my_function(<span style=\"color: #008000;\">4<\/span>)) \u6642\uff0c\u5247 <span style=\"color: #ff0000;\">return<\/span> \u56de <span style=\"color: #ff0000;\">5 \u4e58\u4ee5<\/span> <span style=\"color: #008000;\">4<\/span> \uff0c\u5f97\u5230\u7d50\u679c\u70ba <span style=\"color: #3366ff;\">20<\/span>\u3002<br \/>\n\u7576 print (my_function(<span style=\"color: #008000;\">6<\/span>)) \u6642\uff0c\u5247 <span style=\"color: #ff0000;\">return<\/span> \u56de <span style=\"color: #ff0000;\">5 \u4e58\u4ee5<\/span> <span style=\"color: #008000;\">6<\/span> \uff0c\u5f97\u5230\u7d50\u679c\u70ba <span style=\"color: #3366ff;\">30<\/span>\u3002<\/p>\n<p>\u53c8\u6216\u8005<\/p>\n<pre class=\"lang:python\">def my_function(x):\n  return 100 \/ x\n\nprint(my_function(2))\nprint(my_function(5))\nprint(my_function(10))<\/pre>\n<pre class=\"lang:python\">50.0\n20.0\n10.0<\/pre>\n<p>#\u5b9a\u7fa9 my_function(<span style=\"color: #008000;\">x<\/span>)\uff0c\u518d\u4f7f\u7528 <span style=\"color: #ff0000;\">return<\/span> \u56de\u50b3 <span style=\"color: #ff0000;\">100 \u9664\u4ee5<\/span> <span style=\"color: #008000;\">x<\/span> \u7684\u7d50\u679c\u3002<br \/>\n\u7576 print (my_function(<span style=\"color: #008000;\">2<\/span>)) \u6642\uff0c\u5247 <span style=\"color: #ff0000;\">return<\/span> \u56de <span style=\"color: #ff0000;\">100 \u9664\u4ee5<\/span>\u00a0<span style=\"color: #008000;\">2<\/span> \uff0c\u5f97\u5230\u7d50\u679c\u70ba <span style=\"color: #3366ff;\">50.0<\/span>\u3002<br \/>\n\u7576 print (my_function(<span style=\"color: #008000;\">4<\/span>)) \u6642\uff0c\u5247 <span style=\"color: #ff0000;\">return<\/span> \u56de <span style=\"color: #ff0000;\">100 \u9664\u4ee5<\/span>\u00a0<span style=\"color: #008000;\">5<\/span> \uff0c\u5f97\u5230\u7d50\u679c\u70ba <span style=\"color: #3366ff;\">20.0<\/span>\u3002<br \/>\n\u7576 print (my_function(<span style=\"color: #008000;\">6<\/span>)) \u6642\uff0c\u5247 <span style=\"color: #ff0000;\">return<\/span> \u56de <span style=\"color: #ff0000;\">100 \u9664\u4ee5<\/span>\u00a0<span style=\"color: #008000;\">10<\/span> \uff0c\u5f97\u5230\u7d50\u679c\u70ba <span style=\"color: #3366ff;\">10.0<\/span>\u3002<\/p>\n<h3>6. <a id=\"pass\"><\/a>\u7576\u51fd\u6578\u5b9a\u7fa9\u70ba\u7a7a\u767d\u6642\uff1a<\/h3>\n<h5>\u51fd\u6578\u5b9a\u7fa9\u4e0d\u80fd\u70ba\u7a7a\u767d\uff0c\u4f46\u57fa\u65bc\u67d0\u7a2e\u539f\u56e0\u800c\u9700\u4e00\u500b\u4e0d\u5e36\u4efb\u4f55\u5167\u5bb9\u7684\u51fd\u6578\u5b9a\u7fa9\uff0c\u8acb\u653e\u5165<span style=\"color: #ff0000;\">pass<\/span>\uff0c\u4ee5\u907f\u514d\u51fa\u932f\u3002<\/h5>\n<pre class=\"lang:python\">def myfunction():\n  pass<\/pre>\n<p># \u5728\u5176\u4ed6\u7a0b\u5f0f\u8a9e\u8a00\u6703\u4f7f\u7528 continue<\/p>\n<h3>7. <a id=\"recursion\"><\/a>\u905e\u8ff4 Recursion\uff1a\u9700\u6709 1) \u81ea\u6211\u547c\u559a\u30012) \u7d42\u6b62\u689d\u4ef6<\/h3>\n<p>\u905e\u8ff4\u7684\u6982\u5ff5\u5373\u662f\u5c07\u4e00\u500b\u9f90\u5927\u7684\u554f\u984c\uff0c\u5207\u5272\u6210\u5c0f\u554f\u984c\uff0c\u8b93\u554f\u984c\u8b8a\u5f97\u6bd4\u8f03\u597d\u89e3\u6c7a\u3002<\/p>\n<pre class=\"lang:python\">def recursion(k):\n  if(k &gt; 0):\n    result = k + recursion(k - 1)\n    print(k)\n  else:\n    result = 0\n  return result\n\nprint(\"\\n\\nRecursion Example Results\")\nrecursion(6)<\/pre>\n<pre class=\"lang:python\">Recursion Example Results\n1\n3\n6\n10\n15\n21<\/pre>\n<pre class=\"lang:python\">[Out] 21<\/pre>\n<h5>\u905e\u8ff4\u7684\u689d\u4ef6\uff1a<br \/>\n1) \u81ea\u6211\u547c\u559a\uff1a\u5982 recursion ( k ) \u7b49\u65bc k + recursion ( k &#8211; 1 )\u3002\u4f46\u5047\u5982\u6c92\u6709\u505c\u6b62\u689d\u4ef6\u7684\u8a71\uff0c\u5247\u6703\u7121\u9650\u8f2a\u8ff4\u3002<br \/>\n2) \u7d42\u6b62\u689d\u4ef6\uff1ak \u5c0f\u65bc \u6216 \u7b49\u65bc 0\uff0c\u7d50\u679c\u70ba 0\u3002<\/h5>\n<p>#\u5b9a\u7fa9 <span style=\"color: #ff0000;\">recursion(k)<\/span>\uff0c\u5047\u5982 <span style=\"color: #ff0000;\">k \u7b49\u65bc 6<\/span>\uff08k &gt; 0\uff09\uff0c\u60f3\u5f97\u5230\u7d50\u679c\uff1a<span style=\"color: #ff0000;\">k<\/span> \u52a0\u4e0a <span style=\"color: #0000ff;\">recursion (k &#8211; 1)<\/span>\uff0c\u5247 <span style=\"color: #ff0000;\">recursion(6)<\/span>\uff0c\u5373 <span style=\"color: #ff0000;\">k = 6<\/span>\uff1a\u7d50\u679c\u70ba <span style=\"color: #ff0000;\">k<\/span> + <span style=\"color: #0000ff;\">recursion ( k &#8211; 1 )<\/span> = <span style=\"color: #ff0000;\">6<\/span> + <span style=\"color: #0000ff;\">recursion (5)<\/span>\u3002<\/p>\n<p>\u4ee5\u6b64\u985e\u63a8\uff0c\u7d50\u679c\u70ba<br \/>\n<span style=\"color: #ff0000;\">recursion(6)<\/span><br \/>\n<span style=\"color: #008000;\"><span style=\"color: #000000;\">=<\/span> <span style=\"color: #ff0000;\">6<\/span><\/span> + <span style=\"color: #0000ff;\">recursion (5)<\/span><br \/>\n<span style=\"color: #008000;\"><span style=\"color: #000000;\">=<\/span> <span style=\"color: #000000;\">6<\/span><\/span><span style=\"color: #000000;\"> +<\/span> <span style=\"color: #ff0000;\">5<\/span> + <span style=\"color: #0000ff;\">recursion (4)<br \/>\n<span style=\"color: #008000;\"><span style=\"color: #000000;\">=<\/span> <span style=\"color: #000000;\">6<\/span><\/span><span style=\"color: #000000;\"> + 5 +<\/span> <span style=\"color: #ff0000;\">4<\/span> + recursion (3)<br \/>\n<span style=\"color: #008000;\"><span style=\"color: #000000;\">=<\/span> <span style=\"color: #000000;\">6<\/span><\/span><span style=\"color: #000000;\"> + 5 + 4 +<\/span> <span style=\"color: #ff0000;\">3<\/span> + recursion (2)<br \/>\n<span style=\"color: #008000;\"><span style=\"color: #000000;\">=<\/span> <span style=\"color: #000000;\">6<\/span><\/span><span style=\"color: #000000;\"> + 5 + 4 + 3 +<\/span> <span style=\"color: #ff0000;\">2<\/span> + recursion (1)<\/span><\/p>\n<p>\u6240\u4ee5\u9700\u8981\u77e5\u9053<span style=\"color: #ff0000;\">recursion(6)<span style=\"color: #000000;\">\uff0c\u5247\u9700\u8981\u77e5\u9053<span style=\"color: #0000ff;\">recursion (5)<span style=\"color: #000000;\">\u3001<\/span>recursion (4)<span style=\"color: #000000;\">\u3001<\/span>recursion (3)<span style=\"color: #000000;\">\u3001<\/span>recursion (2)<span style=\"color: #000000;\">\u3001<\/span>recursion (1) <\/span>\u7684\u7d50\u679c\u3002\u56e0\u6b64 <span style=\"color: #0000ff;\">recursion (1) <\/span>\u7684\u7d50\u679c\u6703\u5148\u88ab\u8a08\u7b97\u51fa\u4f86\uff0c\u518d\u4f9d\u6b21\u8a08\u7b97\u51fa<span style=\"color: #0000ff;\">recursion (2)<span style=\"color: #000000;\">\u3001<\/span>recursion (3)<span style=\"color: #000000;\">\u3001<\/span>recursion (4)<span style=\"color: #000000;\">\u3001<\/span>recursion (5) <\/span>\u7684\u7d50\u679c\u3002<\/span><\/span><\/p>\n<p>\u5982\uff1a<br \/>\n<span style=\"color: #ff0000;\"><span style=\"color: #000000;\"><span style=\"color: #0000ff;\">recursion (1) <\/span>\u7684\u7d50\u679c\u70ba\uff1a<span style=\"color: #008000;\">1<\/span>\uff08 1 + 0 = 1 \uff09<br \/>\n<span style=\"color: #0000ff;\">recursion (2) <\/span>\u7684\u7d50\u679c\u70ba\uff1a<span style=\"color: #008000;\">3<\/span>\uff08 2 + 1 = 3 \uff09<br \/>\n<span style=\"color: #0000ff;\">recursion (3) <\/span>\u7684\u7d50\u679c\u70ba\uff1a<span style=\"color: #008000;\">6<\/span>\uff08 3 + 3 = 6 \uff09<br \/>\n<span style=\"color: #0000ff;\">recursion (4) <\/span>\u7684\u7d50\u679c\u70ba\uff1a<span style=\"color: #008000;\">10<\/span>\uff08 4 + 6 = 10 \uff09<br \/>\n<span style=\"color: #0000ff;\">recursion (5) <\/span>\u7684\u7d50\u679c\u70ba\uff1a<span style=\"color: #008000;\">15<\/span>\uff08 5 + 10 = 15 \uff09<br \/>\n<span style=\"color: #0000ff;\">recursion (6) <\/span>\u7684\u7d50\u679c\u70ba\uff1a<span style=\"color: #008000;\">21<\/span>\uff08 6 + 15 = 21 \uff09<\/span><\/span><\/p>\n<p>\u5247\u7d50\u679c\u70ba <span style=\"color: #ff0000;\">21<\/span>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python Data Types \u8cc7\u6599\u985e\u578b &#8211; Functions \u51fd\u6578<\/p>\n","protected":false},"author":3,"featured_media":7431,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,176],"tags":[1201,1202,1152,1193,1194,1154,1204,1203,19,1206,1205,1195,1196,527,1197,1198,1200,1199],"class_list":["post-7331","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-it-technology","category-python","tag-argument","tag-default","tag-for","tag-function","tag-functions","tag-in","tag-key","tag-pass","tag-python","tag-recursion","tag-value","tag-1195","tag-1196","tag-527","tag-1197","tag-1198","tag-1200","tag-1199"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane<\/title>\n<meta name=\"description\" content=\"Python Data Types \u8cc7\u6599\u985e\u578b - Functions \u51fd\u6578\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/myoceane.fr\/index.php\/python-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane\" \/>\n<meta property=\"og:description\" content=\"Python Data Types \u8cc7\u6599\u985e\u578b - Functions \u51fd\u6578\" \/>\n<meta property=\"og:url\" content=\"https:\/\/myoceane.fr\/index.php\/python-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"\u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-19T02:24:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-19T15:14:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Python-functions.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"\u6ab8\u6aac\u5abd\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6ab8\u6aac\u5abd\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/\"},\"author\":{\"name\":\"\u6ab8\u6aac\u5abd\",\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4131a9a9e8a1517447647089109fe4f3\"},\"headline\":\"[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5\",\"datePublished\":\"2021-03-19T02:24:17+00:00\",\"dateModified\":\"2021-03-19T15:14:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/\"},\"wordCount\":337,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b\"},\"image\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Python-functions.jpg\",\"keywords\":[\"argument\",\"default\",\"for\",\"function\",\"functions\",\"in\",\"key\",\"pass\",\"Python\",\"recursion\",\"value\",\"\u51fd\u6578\",\"\u51fd\u6578\u7528\u6cd5\",\"\u521d\u5b78\u8005\",\"\u5b9a\u7fa9\",\"\u6307\u5b9a\u53c3\u6578\",\"\u905e\u8ff4\",\"\u9ed8\u8a8d\u53c3\u6578\"],\"articleSection\":[\"IT Technology\",\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/myoceane.fr\/index.php\/python-functions\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/\",\"url\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/\",\"name\":\"[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane\",\"isPartOf\":{\"@id\":\"https:\/\/myoceane.fr\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Python-functions.jpg\",\"datePublished\":\"2021-03-19T02:24:17+00:00\",\"dateModified\":\"2021-03-19T15:14:11+00:00\",\"description\":\"Python Data Types \u8cc7\u6599\u985e\u578b - Functions \u51fd\u6578\",\"breadcrumb\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/myoceane.fr\/index.php\/python-functions\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/#primaryimage\",\"url\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Python-functions.jpg\",\"contentUrl\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Python-functions.jpg\",\"width\":1200,\"height\":675},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/python-functions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/myoceane.fr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/myoceane.fr\/#website\",\"url\":\"https:\/\/myoceane.fr\/\",\"name\":\"M-Y-Oceane \u60f3\u65b9\u6d89\u6cd5\u3002\u91cf\u74f6\u5916\u7684\u5929\u7a7a\",\"description\":\"\u60f3\u65b9\u6d89\u6cd5, France, Taiwan, Health, Information Technology\",\"publisher\":{\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/myoceane.fr\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b\",\"name\":\"\u6ab8\u6aac\u7238\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g\",\"caption\":\"\u6ab8\u6aac\u7238\"},\"logo\":{\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4131a9a9e8a1517447647089109fe4f3\",\"name\":\"\u6ab8\u6aac\u5abd\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cf16944a7cf34c4bed48684016e7de5a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cf16944a7cf34c4bed48684016e7de5a?s=96&d=mm&r=g\",\"caption\":\"\u6ab8\u6aac\u5abd\"},\"url\":\"https:\/\/myoceane.fr\/index.php\/author\/anataliechougmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","description":"Python Data Types \u8cc7\u6599\u985e\u578b - Functions \u51fd\u6578","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/myoceane.fr\/index.php\/python-functions\/","og_locale":"en_US","og_type":"article","og_title":"[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","og_description":"Python Data Types \u8cc7\u6599\u985e\u578b - Functions \u51fd\u6578","og_url":"https:\/\/myoceane.fr\/index.php\/python-functions\/","og_site_name":"\u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","article_published_time":"2021-03-19T02:24:17+00:00","article_modified_time":"2021-03-19T15:14:11+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Python-functions.jpg","type":"image\/jpeg"}],"author":"\u6ab8\u6aac\u5abd","twitter_card":"summary_large_image","twitter_misc":{"Written by":"\u6ab8\u6aac\u5abd","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/myoceane.fr\/index.php\/python-functions\/#article","isPartOf":{"@id":"https:\/\/myoceane.fr\/index.php\/python-functions\/"},"author":{"name":"\u6ab8\u6aac\u5abd","@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4131a9a9e8a1517447647089109fe4f3"},"headline":"[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5","datePublished":"2021-03-19T02:24:17+00:00","dateModified":"2021-03-19T15:14:11+00:00","mainEntityOfPage":{"@id":"https:\/\/myoceane.fr\/index.php\/python-functions\/"},"wordCount":337,"commentCount":0,"publisher":{"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b"},"image":{"@id":"https:\/\/myoceane.fr\/index.php\/python-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Python-functions.jpg","keywords":["argument","default","for","function","functions","in","key","pass","Python","recursion","value","\u51fd\u6578","\u51fd\u6578\u7528\u6cd5","\u521d\u5b78\u8005","\u5b9a\u7fa9","\u6307\u5b9a\u53c3\u6578","\u905e\u8ff4","\u9ed8\u8a8d\u53c3\u6578"],"articleSection":["IT Technology","Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/myoceane.fr\/index.php\/python-functions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/myoceane.fr\/index.php\/python-functions\/","url":"https:\/\/myoceane.fr\/index.php\/python-functions\/","name":"[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5 - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","isPartOf":{"@id":"https:\/\/myoceane.fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/myoceane.fr\/index.php\/python-functions\/#primaryimage"},"image":{"@id":"https:\/\/myoceane.fr\/index.php\/python-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Python-functions.jpg","datePublished":"2021-03-19T02:24:17+00:00","dateModified":"2021-03-19T15:14:11+00:00","description":"Python Data Types \u8cc7\u6599\u985e\u578b - Functions \u51fd\u6578","breadcrumb":{"@id":"https:\/\/myoceane.fr\/index.php\/python-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/myoceane.fr\/index.php\/python-functions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/myoceane.fr\/index.php\/python-functions\/#primaryimage","url":"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Python-functions.jpg","contentUrl":"https:\/\/myoceane.fr\/wp-content\/uploads\/2021\/03\/Python-functions.jpg","width":1200,"height":675},{"@type":"BreadcrumbList","@id":"https:\/\/myoceane.fr\/index.php\/python-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/myoceane.fr\/"},{"@type":"ListItem","position":2,"name":"[Python\u521d\u5b78\u8005] 7\u7a2e Functions \u51fd\u6578\u7528\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/myoceane.fr\/#website","url":"https:\/\/myoceane.fr\/","name":"M-Y-Oceane \u60f3\u65b9\u6d89\u6cd5\u3002\u91cf\u74f6\u5916\u7684\u5929\u7a7a","description":"\u60f3\u65b9\u6d89\u6cd5, France, Taiwan, Health, Information Technology","publisher":{"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/myoceane.fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b","name":"\u6ab8\u6aac\u7238","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/myoceane.fr\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g","caption":"\u6ab8\u6aac\u7238"},"logo":{"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/image\/"}},{"@type":"Person","@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4131a9a9e8a1517447647089109fe4f3","name":"\u6ab8\u6aac\u5abd","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/myoceane.fr\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cf16944a7cf34c4bed48684016e7de5a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf16944a7cf34c4bed48684016e7de5a?s=96&d=mm&r=g","caption":"\u6ab8\u6aac\u5abd"},"url":"https:\/\/myoceane.fr\/index.php\/author\/anataliechougmail-com\/"}]}},"amp_enabled":false,"_links":{"self":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts\/7331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/comments?post=7331"}],"version-history":[{"count":34,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts\/7331\/revisions"}],"predecessor-version":[{"id":7435,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts\/7331\/revisions\/7435"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/media\/7431"}],"wp:attachment":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/media?parent=7331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/categories?post=7331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/tags?post=7331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}