{"id":2011,"date":"2020-12-29T07:32:40","date_gmt":"2020-12-29T07:32:40","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=2011"},"modified":"2025-03-27T15:14:59","modified_gmt":"2025-03-27T15:14:59","slug":"python-bool","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/advanced-python\/python-bool\/","title":{"rendered":"Python bool"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll have a deep understanding of the Python <code>bool<\/code> class and how to handle boolean values effectively.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-the-python-bool-class'>Introduction to the Python bool class <a href=\"#introduction-to-the-python-bool-class\" class=\"anchor\" id=\"introduction-to-the-python-bool-class\" title=\"Anchor for Introduction to the Python bool class\">#<\/a><\/h2>\n\n\n\n<p>To represent <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-boolean\/\">boolean<\/a> values including <code>True<\/code> and <code>False<\/code>, Python uses the built-in <code>bool<\/code> class.<\/p>\n\n\n\n<p>The <code>bool<\/code> class is the <a href=\"https:\/\/www.pythontutorial.net\/python-oop\/python-inheritance\/\">subclass<\/a> of the <code><a href=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-integers\/\">int<\/a><\/code> class. It means that the <code>bool<\/code> class <a href=\"https:\/\/www.pythontutorial.net\/python-oop\/python-inheritance\/\">inherits<\/a> all properties and methods of the <code>int<\/code> class. In addition, the <code>bool<\/code> class has specific behaviors related to boolean operations.<\/p>\n\n\n\n<p>If you use the <code>issubclass()<\/code> function for the <code>bool<\/code> and <code>int<\/code> classes, it&#8217;ll return <code>True<\/code> as follows:<\/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\">is_child_class = issubclass(bool, int)\nprint(is_child_class)<\/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>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">True<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><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 fact, <code>True<\/code> and <code>False<\/code> are <strong>singleton<\/strong> objects of the <code>bool<\/code> class.<\/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\">isinstance(<span class=\"hljs-literal\">True<\/span>, bool)\nisinstance(<span class=\"hljs-literal\">False<\/span>, bool)<\/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>Output:<\/p>\n\n\n\n<p>The following uses the <code>isinstance()<\/code> function to check if <code>True<\/code> and <code>False<\/code> are the instances of <code>bool<\/code> class:<\/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-literal\">True<\/span>\n<span class=\"hljs-literal\">True<\/span>   <\/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>Since both <code>True<\/code> and <code>False<\/code> are also <code>int<\/code> objects, you can convert them to integers:<\/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\">true_value = int(<span class=\"hljs-literal\">True<\/span>)\nprint(true_value)\n\nfalse_value = int(<span class=\"hljs-literal\">False<\/span>)\nprint(false_value)<\/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>Output:<\/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-number\">1<\/span>\n<span class=\"hljs-number\">0<\/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>Python interprets <code>True<\/code> as 1 and <code>False<\/code> as 0.<\/p>\n\n\n\n<p>Please note that <code>True<\/code> and 1 are not the same object. Likewise, <code>False<\/code> and 0 are not the same.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='comparing-boolean-values'>Comparing boolean values <a href=\"#comparing-boolean-values\" class=\"anchor\" id=\"comparing-boolean-values\" title=\"Anchor for Comparing boolean values\">#<\/a><\/h2>\n\n\n\n<p>Since <code>True<\/code> and <code>False<\/code> are singleton objects that always <a href=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-references\/\">reference<\/a> the same objects in the memory throughout the program.<\/p>\n\n\n\n<p>Therefore, you can use either <code>is<\/code> or <code>==<\/code> operator to compare boolean values. The results are the same. For example:<\/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\">a = <span class=\"hljs-literal\">True<\/span>\nb = <span class=\"hljs-literal\">True<\/span>\n\nprint(a == b)\nprint(a <span class=\"hljs-keyword\">is<\/span> b)<\/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><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=YSA9IFRydWUKYiA9IFRydWUKCnByaW50KGEgPT0gYikKcHJpbnQoYSBpcyBiKQ%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-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">True<\/span>\n<span class=\"hljs-keyword\">True<\/span>   <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><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>The same is applied to the <code>False<\/code> object:<\/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\">a = <span class=\"hljs-literal\">False<\/span>\nb = <span class=\"hljs-literal\">False<\/span>\n\nprint(a == b)\nprint(a <span class=\"hljs-keyword\">is<\/span> b)<\/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><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=YSA9IEZhbHNlCmIgPSBGYWxzZQoKcHJpbnQoYSA9PSBiKQpwcmludChhIGlzIGIp\" 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-10\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">True<\/span>\n<span class=\"hljs-keyword\">True<\/span>   <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><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<h2 class=\"wp-block-heading\" id='how-python-bool-constructor-works-under-the-hood'>How Python bool() constructor works under the hood <a href=\"#how-python-bool-constructor-works-under-the-hood\" class=\"anchor\" id=\"how-python-bool-constructor-works-under-the-hood\" title=\"Anchor for How Python bool() constructor works under the hood\">#<\/a><\/h2>\n\n\n\n<p>The Boolean constructor <code>bool()<\/code> accepts an object and returns <code>True<\/code> or <code>False<\/code>.<\/p>\n\n\n\n<p>In Python, a class always contains a definition of how its instances evaluate to <code>True<\/code> and <code>False<\/code>. In other words, every object can be either <code>True<\/code> or <code>False<\/code>.<\/p>\n\n\n\n<p>All objects have a boolean value of <code>True<\/code>, except the following objects:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>None<\/code><\/li>\n\n\n\n<li><code>False<\/code><\/li>\n\n\n\n<li><code>0<\/code> in any numeric type such as integer, float, and decimal.<\/li>\n\n\n\n<li>Empty sequences e.g., list, tuple, string.<\/li>\n\n\n\n<li>Empty mapping types e.g., dictionary, set.<\/li>\n\n\n\n<li>Custom classes that implement <code>__bool__()<\/code> or <code>__len__()<\/code> methods that return <code>False<\/code> or <code>0<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>&#8230;which have a boolean value of <code>False<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='the-__bool__-method'>The __bool__() method <a href=\"#the-__bool__-method\" class=\"anchor\" id=\"the-__bool__-method\" title=\"Anchor for The __bool__() method\">#<\/a><\/h3>\n\n\n\n<p>When you pass an object to the <code>bool()<\/code> constructor, Python returns the value of the <code>__bool__()<\/code> method of that object.<\/p>\n\n\n\n<p>For example, the following shows the <code>__bool__()<\/code> method of the <code>int<\/code> class:<\/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-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__bool__<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n    <span class=\"hljs-keyword\">return<\/span> self != <span class=\"hljs-number\">0<\/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>When you call:<\/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\">bool(<span class=\"hljs-number\">200<\/span>)<\/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>&#8230;Python actually executes:<\/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-number\">200.<\/span>__bool__()<\/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>&#8230;and therefore returns the result of <code>200 != 0<\/code>, which is <code>True<\/code>.<\/p>\n\n\n\n<p>However, if you call:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">bool(<span class=\"hljs-number\">0<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><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;Python executes:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">0.<\/span>__bool__()<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><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;and therefore returns the result of <code>0 != 0<\/code>, which is <code>False<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='the-__len__-method'>The __len__() method <a href=\"#the-__len__-method\" class=\"anchor\" id=\"the-__len__-method\" title=\"Anchor for The __len__() method\">#<\/a><\/h3>\n\n\n\n<p>If the class of the object doesn&#8217;t have the <code>__bool__()<\/code> method, Python will return the result of <code>__len__()<\/code> method.<\/p>\n\n\n\n<p>If the result of the <code>__len__()<\/code> method is zero, the <code>bool()<\/code> returns <code>False<\/code>. Otherwise, it returns <code>True<\/code>.<\/p>\n\n\n\n<p>That&#8217;s why an empty list is always <code>False<\/code> while a list with at least one element is <code>True<\/code>.<\/p>\n\n\n\n<p>Suppose that you have a function that returns a list or <code>None<\/code>. The result list can have zero or more elements:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-16\" 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\">get_list<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    <span class=\"hljs-comment\"># ...<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-16\"><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 display the elements of the list, you may come up with the following code:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-17\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">my_list = get_list()\n\n<span class=\"hljs-keyword\">if<\/span> my_list <span class=\"hljs-keyword\">is<\/span> <span class=\"hljs-keyword\">not<\/span> <span class=\"hljs-literal\">None<\/span> <span class=\"hljs-keyword\">and<\/span> len(my_list) &gt; <span class=\"hljs-number\">0<\/span>:\n    <span class=\"hljs-keyword\">for<\/span> element <span class=\"hljs-keyword\">in<\/span> my_list:\n        print(element)\n<span class=\"hljs-keyword\">else<\/span>:\n    print(<span class=\"hljs-string\">'List is None or empty'<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-17\"><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 condition in the <code>if<\/code> clause makes sure that <code>my_list<\/code> is not <code>None<\/code> or <code>empty<\/code>.<\/p>\n\n\n\n<p>However, this condition is unnecessary because you can shorten it like this. The code works the same:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-18\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">my_list = get_list()\n\n<span class=\"hljs-keyword\">if<\/span> my_list:\n    <span class=\"hljs-keyword\">for<\/span> element <span class=\"hljs-keyword\">in<\/span> my_list:\n        print(element)\n<span class=\"hljs-keyword\">else<\/span>:\n    print(<span class=\"hljs-string\">'List is None or empty'<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-18\"><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 case, if the <code>my_list<\/code> is <code>None<\/code> or empty, then Python evaluates it to <code>False<\/code>.<\/p>\n\n\n\n<p>Finally, if a class that doesn&#8217;t have both <code>__bool__()<\/code> and <code>__len__()<\/code> methods, the instances of that class always evaluate to <code>True<\/code>.<\/p>\n\n\n\n<p>The following flowchart illustrates how the <code>bool()<\/code> works:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"694\" height=\"660\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2021\/02\/python-bool.png\" alt=\"Python bool\" class=\"wp-image-2230\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2021\/02\/python-bool.png 694w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2021\/02\/python-bool-300x285.png 300w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><\/figure>\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>Python uses the <code>bool<\/code> class to represent boolean values: <code>True<\/code> and <code>False<\/code>.<\/li>\n\n\n\n<li><code>True<\/code> and <code>False<\/code> are instances of the <code>bool<\/code> class. In fact, they&#8217;re singleton objects of the <code>bool<\/code> class.<\/li>\n\n\n\n<li>Every object has a boolean value, which can be <code>True<\/code> or <code>False<\/code>. The <code>bool(object)<\/code> returns the Boolean value of the <code>obj<\/code>.<\/li>\n\n\n\n<li>Under the hood the <code>bool()<\/code> returns a Boolean value by calling the <code>__bool__()<\/code> or <code>__len__()<\/code> method of the object. If both methods don&#8217;t exist, the bool() returns <code>True<\/code>.<\/li>\n<\/ul>\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=\"2011\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-bool\/\"\n\t\t\t\tdata-post-title=\"Python bool\"\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=\"2011\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-bool\/\"\n\t\t\t\tdata-post-title=\"Python bool\"\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 have a deep understanding of the Python bool class and how to handle boolean values effectively.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":757,"menu_order":27,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2011","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2011","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=2011"}],"version-history":[{"count":2,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2011\/revisions"}],"predecessor-version":[{"id":7139,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2011\/revisions\/7139"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/757"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=2011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}