{"id":725,"date":"2020-10-23T03:41:24","date_gmt":"2020-10-23T03:41:24","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=725"},"modified":"2025-03-31T04:08:28","modified_gmt":"2025-03-31T04:08:28","slug":"python-while-else","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/python-basics\/python-while-else\/","title":{"rendered":"Python while else"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn about the Python <code>while else<\/code> statement and how to use it effectively.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-python-while-else-statement'>Introduction to Python while else statement <a href=\"#introduction-to-python-while-else-statement\" class=\"anchor\" id=\"introduction-to-python-while-else-statement\" title=\"Anchor for Introduction to Python while else statement\">#<\/a><\/h2>\n\n\n\n<p>In Python, the <code><a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-while\/\">while<\/a><\/code> statement may have an optional <code>else<\/code> clause:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">while<\/span> condition:\n    <span class=\"hljs-comment\"># code block to run<\/span>\n<span class=\"hljs-keyword\">else<\/span>:\n    <span class=\"hljs-comment\"># else clause code block<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this syntax, the <code>condition<\/code> is checked at the beginning of each iteration. The code block inside the <code>while<\/code> statement will execute as long as the <code>condition<\/code> is <code>True<\/code>.<\/p>\n\n\n\n<p>When the <code>condition<\/code> becomes <code>False<\/code> and the loop runs normally, the <code>else<\/code> clause will execute. However, if the loop is terminated prematurely by either a <code><a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-break\/\">break<\/a><\/code> or <code>return<\/code> statement, the <code>else<\/code> clause won&#8217;t execute at all.<\/p>\n\n\n\n<p>The following flowchart illustrates the <code>while...else<\/code> clause:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"528\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-while-else.png\" alt=\"\" class=\"wp-image-853\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-while-else.png 372w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-while-else-211x300.png 211w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/figure>\n<\/div>\n\n\n<p>If you&#8217;re familiar with other programming languages such as <a href=\"https:\/\/www.javascripttutorial.net\/javascript-while-loop\/\" target=\"_blank\" rel=\"noreferrer noopener\">JavaScript<\/a>, Java, or C#, you&#8217;ll find that the <code>else<\/code> clause is quite strange in the context of a loop.<\/p>\n\n\n\n<p>However, the <code>while...else<\/code> clause turns out to be very useful in some cases. Let&#8217;s take a look at an example of using the <code>while...else<\/code> statement.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='python-while-else-statement-example'>Python while&#8230;else statement example <a href=\"#python-while-else-statement-example\" class=\"anchor\" id=\"python-while-else-statement-example\" title=\"Anchor for Python while...else statement example\">#<\/a><\/h2>\n\n\n\n<p>Suppose we have the following list of fruits where each fruit is a dictionary that consists of the <code>fruit<\/code> name and <code>qty<\/code> keys:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">basket = &#91;\n    {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'apple'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: <span class=\"hljs-number\">20<\/span>},\n    {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'banana'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: <span class=\"hljs-number\">30<\/span>},\n    {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'orange'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: <span class=\"hljs-number\">10<\/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\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>We want to make a program that allows the users to enter a fruit name. Based on the input name, we&#8217;ll search for it from the <code>basket<\/code> list and show its quantity if the fruit is on the list.<\/p>\n\n\n\n<p>In case the fruit is not found, we&#8217;ll allow users to enter the quantity for that fruit and add it to the list.<\/p>\n\n\n\n<p>The following program is the first attempt:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">basket = &#91;\n    {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'apple'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: <span class=\"hljs-number\">20<\/span>},\n    {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'banana'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: <span class=\"hljs-number\">30<\/span>},\n    {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'orange'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: <span class=\"hljs-number\">10<\/span>}\n]\n\nfruit = input(<span class=\"hljs-string\">'Enter a fruit:'<\/span>)\n\nindex = <span class=\"hljs-number\">0<\/span>\nfound_it = <span class=\"hljs-keyword\">False<\/span>\n\n<span class=\"hljs-keyword\">while<\/span> index &lt; len(basket):\n    item = basket&#91;index]\n    <span class=\"hljs-comment\"># check the fruit name<\/span>\n    <span class=\"hljs-keyword\">if<\/span> item&#91;<span class=\"hljs-string\">'fruit'<\/span>] == fruit:\n        found_it = <span class=\"hljs-keyword\">True<\/span>\n        <span class=\"hljs-keyword\">print<\/span>(f<span class=\"hljs-string\">\"The basket has {item&#91;'qty']} {item&#91;'fruit']}(s)\"<\/span>)\n        <span class=\"hljs-keyword\">break<\/span>\n\n    index += <span class=\"hljs-number\">1<\/span>\n\n<span class=\"hljs-keyword\">if<\/span> not found_it:\n    qty = int(input(f<span class=\"hljs-string\">'Enter the qty for {fruit}:'<\/span>))\n    basket.append({<span class=\"hljs-string\">'fruit'<\/span>: fruit, <span class=\"hljs-string\">'qty'<\/span>: qty})\n    <span class=\"hljs-keyword\">print<\/span>(basket)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=YmFza2V0ID0gWwogICAgeydmcnVpdCc6ICdhcHBsZScsICdxdHknOiAyMH0sCiAgICB7J2ZydWl0JzogJ2JhbmFuYScsICdxdHknOiAzMH0sCiAgICB7J2ZydWl0JzogJ29yYW5nZScsICdxdHknOiAxMH0KXQoKZnJ1aXQgPSBpbnB1dCgnRW50ZXIgYSBmcnVpdDonKQoKaW5kZXggPSAwCmZvdW5kX2l0ID0gRmFsc2UKCndoaWxlIGluZGV4IDwgbGVuKGJhc2tldCk6CiAgICBpdGVtID0gYmFza2V0W2luZGV4XQogICAgIyBjaGVjayB0aGUgZnJ1aXQgbmFtZQogICAgaWYgaXRlbVsnZnJ1aXQnXSA9PSBmcnVpdDoKICAgICAgICBmb3VuZF9pdCA9IFRydWUKICAgICAgICBwcmludChmIlRoZSBiYXNrZXQgaGFzIHtpdGVtWydxdHknXX0ge2l0ZW1bJ2ZydWl0J119KHMpIikKICAgICAgICBicmVhawoKICAgIGluZGV4ICs9IDEKCmlmIG5vdCBmb3VuZF9pdDoKICAgIHF0eSA9IGludChpbnB1dChmJ0VudGVyIHRoZSBxdHkgZm9yIHtmcnVpdH06JykpCiAgICBiYXNrZXQuYXBwZW5kKHsnZnJ1aXQnOiBmcnVpdCwgJ3F0eSc6IHF0eX0pCiAgICBwcmludChiYXNrZXQp\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p class=\"note\">Note that there&#8217;s better way to develop this program. The program in this example is solely for the demonstration purpose.<\/p>\n\n\n\n<p>How it works:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, prompt for an user input by using the <code>input()<\/code> function.<\/li>\n\n\n\n<li>Second, initialize the <code>index<\/code> to zero and <code>found_it<\/code> flag to <code>False<\/code>. The <code>index<\/code> will be used for accessing the list by index. And the <code>found_it<\/code> flag will be set to <code>True<\/code> if the fruit name will be found.<\/li>\n\n\n\n<li>Third, iterate over the list and check if the fruit name matched with the input name. If yes, set the <code>found_it<\/code> flag to <code>True<\/code>, show the fruit&#8217;s quantity, and exit the loop by using the <code>break<\/code> statement.<\/li>\n\n\n\n<li>Finally, check the <code>found_it<\/code> flag after the loop and add the new fruit to the list if the <code>found_it<\/code> is <code>False<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>The following runs the program when <code>apple<\/code> is the input:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">Enter<\/span> <span class=\"hljs-selector-tag\">a<\/span> <span class=\"hljs-selector-tag\">fruit<\/span><span class=\"hljs-selector-pseudo\">:apple<\/span>\n<span class=\"hljs-selector-tag\">The<\/span> <span class=\"hljs-selector-tag\">basket<\/span> <span class=\"hljs-selector-tag\">has<\/span> 20 <span class=\"hljs-selector-tag\">apple<\/span>(<span class=\"hljs-selector-tag\">s<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>And the following runs the program when lemon is the input:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">Enter<\/span> <span class=\"hljs-selector-tag\">a<\/span> <span class=\"hljs-selector-tag\">fruit<\/span><span class=\"hljs-selector-pseudo\">:lemon<\/span>\n<span class=\"hljs-selector-tag\">Enter<\/span> <span class=\"hljs-selector-tag\">the<\/span> <span class=\"hljs-selector-tag\">qty<\/span> <span class=\"hljs-selector-tag\">for<\/span> <span class=\"hljs-selector-tag\">lemon<\/span><span class=\"hljs-selector-pseudo\">:15<\/span>\n<span class=\"hljs-selector-attr\">&#91;{<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'apple'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: 20}, {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'banana'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: 30}, {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'orange'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: 10}, {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'lemon'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: 15}]<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The program works as expected.<\/p>\n\n\n\n<p>However, it&#8217;ll be more concise if you use the <code>while else<\/code> statement instead.<\/p>\n\n\n\n<p>The following shows the new version of the program that uses the <code>while else<\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">basket = &#91;\n    {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'apple'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: <span class=\"hljs-number\">20<\/span>},\n    {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'banana'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: <span class=\"hljs-number\">30<\/span>},\n    {<span class=\"hljs-string\">'fruit'<\/span>: <span class=\"hljs-string\">'orange'<\/span>, <span class=\"hljs-string\">'qty'<\/span>: <span class=\"hljs-number\">10<\/span>}\n]\n\nfruit = input(<span class=\"hljs-string\">'Enter a fruit:'<\/span>)\n\nindex = <span class=\"hljs-number\">0<\/span>\n\n<span class=\"hljs-keyword\">while<\/span> index &lt; len(basket):\n    item = basket&#91;index]\n    <span class=\"hljs-comment\"># check the fruit name<\/span>\n    <span class=\"hljs-keyword\">if<\/span> item&#91;<span class=\"hljs-string\">'fruit'<\/span>] == fruit:\n        <span class=\"hljs-keyword\">print<\/span>(f<span class=\"hljs-string\">\"The basket has {item&#91;'qty']} {item&#91;'fruit']}(s)\"<\/span>)\n        found_it = <span class=\"hljs-keyword\">True<\/span>\n        <span class=\"hljs-keyword\">break<\/span>\n\n    index += <span class=\"hljs-number\">1<\/span>\n<span class=\"hljs-keyword\">else<\/span>:\n    qty = int(input(f<span class=\"hljs-string\">'Enter the qty for {fruit}:'<\/span>))\n    basket.append({<span class=\"hljs-string\">'fruit'<\/span>: fruit, <span class=\"hljs-string\">'qty'<\/span>: qty})\n    <span class=\"hljs-keyword\">print<\/span>(basket)\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=YmFza2V0ID0gWwogICAgeydmcnVpdCc6ICdhcHBsZScsICdxdHknOiAyMH0sCiAgICB7J2ZydWl0JzogJ2JhbmFuYScsICdxdHknOiAzMH0sCiAgICB7J2ZydWl0JzogJ29yYW5nZScsICdxdHknOiAxMH0KXQoKZnJ1aXQgPSBpbnB1dCgnRW50ZXIgYSBmcnVpdDonKQoKaW5kZXggPSAwCgp3aGlsZSBpbmRleCA8IGxlbihiYXNrZXQpOgogICAgaXRlbSA9IGJhc2tldFtpbmRleF0KICAgICMgY2hlY2sgdGhlIGZydWl0IG5hbWUKICAgIGlmIGl0ZW1bJ2ZydWl0J10gPT0gZnJ1aXQ6CiAgICAgICAgcHJpbnQoZiJUaGUgYmFza2V0IGhhcyB7aXRlbVsncXR5J119IHtpdGVtWydmcnVpdCddfShzKSIpCiAgICAgICAgZm91bmRfaXQgPSBUcnVlCiAgICAgICAgYnJlYWsKCiAgICBpbmRleCArPSAxCmVsc2U6CiAgICBxdHkgPSBpbnQoaW5wdXQoZidFbnRlciB0aGUgcXR5IGZvciB7ZnJ1aXR9OicpKQogICAgYmFza2V0LmFwcGVuZCh7J2ZydWl0JzogZnJ1aXQsICdxdHknOiBxdHl9KQogICAgcHJpbnQoYmFza2V0KQ%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>In this program, the <code>else<\/code> clause replaces the need of having the <code>found_it<\/code> flag and the <code>if<\/code> statement after the loop.<\/p>\n\n\n\n<p>If the fruit is not found, the <code>while<\/code> loop is terminated normally and the <code>else<\/code> clause will be executed to add a new fruit to the list.<\/p>\n\n\n\n<p>However, if the fruit is found, the <code>while<\/code> loop will be encountered the <code>break<\/code> statement and terminated prematurely. In this case, the <code>else<\/code> clause won&#8217;t be executed.<\/p>\n\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>The <code>else<\/code> clause in the <code>while else<\/code> statement will execute when the <code>condition<\/code> of the <code>while<\/code> loop is <code>False<\/code> and the loop runs normally without encountering the <code>break<\/code> or <code>return<\/code> statement.<\/li>\n\n\n\n<li>Try the Python <code>while else<\/code> statement whenever you need to have a flag in a <code>while<\/code> loop.<\/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=while-else\"\n  height=\"700\"\n  width=\"600\"\n  class=\"iframe\"\n><\/iframe>\n\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=\"725\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-basics\/python-while-else\/\"\n\t\t\t\tdata-post-title=\"Python while else\"\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=\"725\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-basics\/python-while-else\/\"\n\t\t\t\tdata-post-title=\"Python while else\"\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 the Python while else statement and how to use it effectively.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":37,"menu_order":50,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-725","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/725","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=725"}],"version-history":[{"count":3,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/725\/revisions"}],"predecessor-version":[{"id":7282,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/725\/revisions\/7282"}],"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=725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}