{"id":247,"date":"2020-10-05T06:01:43","date_gmt":"2020-10-05T06:01:43","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=247"},"modified":"2025-03-26T12:44:12","modified_gmt":"2025-03-26T12:44:12","slug":"python-recursive-functions","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/python-basics\/python-recursive-functions\/","title":{"rendered":"Python Recursive Functions"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn about Python recursive functions and how to use them to simplify your code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-recursive-functions'>Introduction to recursive functions <a href=\"#introduction-to-recursive-functions\" class=\"anchor\" id=\"introduction-to-recursive-functions\" title=\"Anchor for Introduction to recursive functions\">#<\/a><\/h2>\n\n\n\n<p>A recursive function is a <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-functions\/\">function<\/a> that calls itself until it doesn&#8217;t.<\/p>\n\n\n\n<p>The following <code>fn()<\/code> function is a recursive function because it has a call to itself:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">fn<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    <span class=\"hljs-comment\"># ...<\/span>\n    fn()\n    <span class=\"hljs-comment\"># ...<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In the <code>fn()<\/code> function, the <code>#...<\/code> means other code.<\/p>\n\n\n\n<p>Additionally, a recursive function needs to have a condition to stop calling itself. So you need to add an <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-if\/\">if statement<\/a> like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">fn<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    <span class=\"hljs-comment\"># ...<\/span>\n    <span class=\"hljs-keyword\">if<\/span> condition:\n        <span class=\"hljs-comment\"># stop calling itself<\/span>\n    <span class=\"hljs-keyword\">else<\/span>:\n        fn()\n    <span class=\"hljs-comment\"># ...<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Typically, you use a recursive function to divide a big problem that&#8217;s difficult to solve into smaller problems that are easier to solve.<\/p>\n\n\n\n<p>In programming, you&#8217;ll often find the recursive functions used in data structures and algorithms like trees, graphs, and binary searches.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='python-recursive-function-examples'>Python recursive function examples <a href=\"#python-recursive-function-examples\" class=\"anchor\" id=\"python-recursive-function-examples\" title=\"Anchor for Python recursive function examples\">#<\/a><\/h2>\n\n\n\n<p>Let&#8217;s take some examples of using Python recursive functions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='a-simple-recursive-function-example-in-python'>A simple recursive function example in Python <a href=\"#a-simple-recursive-function-example-in-python\" class=\"anchor\" id=\"a-simple-recursive-function-example-in-python\" title=\"Anchor for A simple recursive function example in Python\">#<\/a><\/h3>\n\n\n\n<p>Suppose you need to develop a countdown function that counts down from a specified number to zero.<\/p>\n\n\n\n<p>For example, if you call the function that counts down from 3, it&#8217;ll show the following output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">3<\/span>\n<span class=\"hljs-number\">2<\/span>\n<span class=\"hljs-number\">1<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The following defines the <code>count_down()<\/code> function:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">count_down<\/span><span class=\"hljs-params\">(start)<\/span>:<\/span>\n    <span class=\"hljs-string\">\"\"\" Count down from a number  \"\"\"<\/span>\n    print(start)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If you call the <code>count_down()<\/code> function now:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">count_down(<span class=\"hljs-number\">3<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>&#8230;it&#8217;ll show only the number 3.<\/p>\n\n\n\n<p>To show the numbers 3, 2, and 1, you need to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, call the <code>count_down(3)<\/code> to show the number 3.<\/li>\n\n\n\n<li>Second, call the <code>count_down(2)<\/code> to show the number 2.<\/li>\n\n\n\n<li>Finally, call the <code>count_down(1)<\/code> to show the number 1.<\/li>\n<\/ul>\n\n\n\n<p>In order to do so, inside the <code>count_down()<\/code> function, you&#8217;ll need to define a logic to call the function <code>count_down()<\/code> with argument 2, and 1.<\/p>\n\n\n\n<p>To do it, you need to make the <code>count_down()<\/code> function recursive.<\/p>\n\n\n\n<p>The following defines a recursive <code>count_down()<\/code> function and calls it by passing the number 3:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">count_down<\/span><span class=\"hljs-params\">(start)<\/span>:<\/span>\n    <span class=\"hljs-string\">\"\"\" Count down from a number  \"\"\"<\/span>\n    print(start)\n    count_down(start<span class=\"hljs-number\">-1<\/span>)\n\n\ncount_down(<span class=\"hljs-number\">3<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=ZGVmIGNvdW50X2Rvd24oc3RhcnQpOgogICAgIiIiIENvdW50IGRvd24gZnJvbSBhIG51bWJlciAgIiIiCiAgICBwcmludChzdGFydCkKICAgIGNvdW50X2Rvd24oc3RhcnQtMSkKCgpjb3VudF9kb3duKDMp\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>If you execute the program, you&#8217;ll see the following error:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">RecursionError: maximum recursion depth exceeded <span class=\"hljs-keyword\">while<\/span> calling a Python object<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The reason is that the <code>count_down()<\/code> calls itself indefinitely until the system stops it.<\/p>\n\n\n\n<p>Since you need to stop counting down the number reaches zero. To do so, you add a condition like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">count_down<\/span><span class=\"hljs-params\">(start)<\/span>:<\/span>\n    <span class=\"hljs-string\">\"\"\" Count down from a number  \"\"\"<\/span>\n    print(start)\n\n    <span class=\"hljs-comment\"># call the count_down if the next<\/span>\n    <span class=\"hljs-comment\"># number is greater than 0<\/span>\n    next = start - <span class=\"hljs-number\">1<\/span>\n    <span class=\"hljs-keyword\">if<\/span> next &gt; <span class=\"hljs-number\">0<\/span>:\n        count_down(next)\n\n\ncount_down(<span class=\"hljs-number\">3<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=ZGVmIGNvdW50X2Rvd24oc3RhcnQpOgogICAgIiIiIENvdW50IGRvd24gZnJvbSBhIG51bWJlciAgIiIiCiAgICBwcmludChzdGFydCkKCiAgICAjIGNhbGwgdGhlIGNvdW50X2Rvd24gaWYgdGhlIG5leHQKICAgICMgbnVtYmVyIGlzIGdyZWF0ZXIgdGhhbiAwCiAgICBuZXh0ID0gc3RhcnQgLSAxCiAgICBpZiBuZXh0ID4gMDoKICAgICAgICBjb3VudF9kb3duKG5leHQpCgoKY291bnRfZG93bigzKQ%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">3<\/span>\n<span class=\"hljs-number\">2<\/span>\n<span class=\"hljs-number\">1<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, the <code>count_down()<\/code> function only calls itself when the next number is greater than zero. In other words, if the next number is zero, it stops calling itself.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='using-a-recursive-function-to-calculate-the-sum-of-a-sequence'>Using a recursive function to calculate the sum of  a sequence <a href=\"#using-a-recursive-function-to-calculate-the-sum-of-a-sequence\" class=\"anchor\" id=\"using-a-recursive-function-to-calculate-the-sum-of-a-sequence\" title=\"Anchor for Using a recursive function to calculate the sum of  a sequence\">#<\/a><\/h3>\n\n\n\n<p>Suppose that you need to calculate a sum of a sequence e.g., from 1 to 100. A simple way to do this is to use a <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-for-range\/\">for loop with the range() function<\/a>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">sum<\/span><span class=\"hljs-params\">(n)<\/span>:<\/span>\n    total = <span class=\"hljs-number\">0<\/span>\n    <span class=\"hljs-keyword\">for<\/span> index <span class=\"hljs-keyword\">in<\/span> range(n+<span class=\"hljs-number\">1<\/span>):\n        total += index\n\n    <span class=\"hljs-keyword\">return<\/span> total\n\n\nresult = sum(<span class=\"hljs-number\">100<\/span>)\nprint(result)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=ZGVmIHN1bShuKToKICAgIHRvdGFsID0gMAogICAgZm9yIGluZGV4IGluIHJhbmdlKG4rMSk6CiAgICAgICAgdG90YWwgKz0gaW5kZXgKCiAgICByZXR1cm4gdG90YWwKCgpyZXN1bHQgPSBzdW0oMTAwKQpwcmludChyZXN1bHQp\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">5050<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>To apply the recursion technique, you can calculate the sum of the sequence from 1 to n as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sum(n) = n + sum(n-1)<\/li>\n\n\n\n<li>sum(n-1) = n-1 + sum(n-2)<\/li>\n\n\n\n<li>&#8230;<\/li>\n\n\n\n<li>sum(0) = 0<\/li>\n<\/ul>\n\n\n\n<p>The <code>sum()<\/code> function keeps calling itself as long as its argument is greater than zero.<\/p>\n\n\n\n<p>The following defines the recursive version of the <code>sum()<\/code> function:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">sum<\/span><span class=\"hljs-params\">(n)<\/span>:<\/span>\n    <span class=\"hljs-keyword\">if<\/span> n &gt; <span class=\"hljs-number\">0<\/span>:\n        <span class=\"hljs-keyword\">return<\/span> n + sum(n<span class=\"hljs-number\">-1<\/span>)\n    <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-number\">0<\/span>\n\n\nresult = sum(<span class=\"hljs-number\">100<\/span>)\nprint(result)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=ZGVmIHN1bShuKToKICAgIGlmIG4gPiAwOgogICAgICAgIHJldHVybiBuICsgc3VtKG4tMSkKICAgIHJldHVybiAwCgoKcmVzdWx0ID0gc3VtKDEwMCkKcHJpbnQocmVzdWx0KQ%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">5050<\/code><\/span><\/pre>\n\n\n<p>The recursive function is much shorter and more readable.<\/p>\n\n\n\n<p>If you use the <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-ternary-operator\/\">ternary operator<\/a>, the <code>sum()<\/code> will be even more concise:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">sum<\/span><span class=\"hljs-params\">(n)<\/span>:<\/span>\n    <span class=\"hljs-keyword\">return<\/span> n + sum(n<span class=\"hljs-number\">-1<\/span>) <span class=\"hljs-keyword\">if<\/span> n &gt; <span class=\"hljs-number\">0<\/span> <span class=\"hljs-keyword\">else<\/span> <span class=\"hljs-number\">0<\/span>\n\n\nresult = sum(<span class=\"hljs-number\">100<\/span>)\nprint(result)\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=ZGVmIHN1bShuKToKICAgIHJldHVybiBuICsgc3VtKG4tMSkgaWYgbiA%2BIDAgZWxzZSAwCgoKcmVzdWx0ID0gc3VtKDEwMCkKcHJpbnQocmVzdWx0KQ%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">5050<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A recursive function is a function that calls itself until it doesn&#8217;t.<\/li>\n\n\n\n<li>And a recursive function always has a condition that stops calling itself.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='quiz'>Quiz <a href=\"#quiz\" class=\"anchor\" id=\"quiz\" title=\"Anchor for Quiz\">#<\/a><\/h2>\n\n\n\n<iframe loading=\"lazy\"\n  name=\"quiz\"\n  src=\"\/quiz\/?quiz=recursive-function\"\n  height=\"700\"\n  width=\"600\"\n  class=\"iframe\"\n><\/iframe>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"247\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-basics\/python-recursive-functions\/\"\n\t\t\t\tdata-post-title=\"Python Recursive Functions\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"247\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-basics\/python-recursive-functions\/\"\n\t\t\t\tdata-post-title=\"Python Recursive Functions\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn about Python recursive functions and how to use them to simplify your code.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":37,"menu_order":22,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-247","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/247","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/comments?post=247"}],"version-history":[{"count":1,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/247\/revisions"}],"predecessor-version":[{"id":6990,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/247\/revisions\/6990"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/37"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}