{"id":12840,"date":"2020-09-12T14:35:27","date_gmt":"2020-09-12T21:35:27","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=12840"},"modified":"2023-12-01T03:59:38","modified_gmt":"2023-12-01T11:59:38","slug":"python-boolean","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-boolean\/","title":{"rendered":"Python Boolean: A Complete Guide"},"content":{"rendered":"\n<p><em>The Python Boolean <\/em><a href=\"https:\/\/careerkarma.com\/blog\/python-data-types\/\"><em>data type<\/em><\/a><em> has only two possible states, the keywords <\/em><code>False<\/code><em> and <\/em><code>True<\/code><em>. Booleans cannot hold any other value, and are the smallest data type. Booleans are essential to many aspects of programming, like the use of if statements. <\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>Note on capitalization.<\/strong> The word <em>Boolean<\/em>, named after the mathematician George Boole, is always capitalized. In addition, the words <em>True<\/em> and <em>False<\/em> are capitalized in Python because they are reserved keywords in the programming language.<\/p>\n\n\n\n<p>To help you get started with Python Booleans, we wrote this tutorial on Boolean basics. We\u2019ll discuss how to use Booleans to evaluate variables and expressions. And we\u2019ll show how Booleans can be used with <a href=\"https:\/\/careerkarma.com\/blog\/python-if-else\/#:~:text=Python%20if%20else%20statements%20are,in%20the%20statement%20is%20executed.\">Python <em>if<\/em> statements<\/a> to control the flow of a program.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python Boolean<\/h2>\n\n\n\n<p>Booleans are used to represent truth values, and they derive from mathematics and arithmetic. In fact, Booleans are the building blocks of complex algorithms. When you\u2019re programming, you use Booleans to evaluate expressions and return an outcome that is either True or False.<\/p>\n\n\n\n<p>Here\u2019s an example of a Boolean Python uses to store whether it is summer:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>is_summer = False<\/pre><\/div>\n\n\n\n<p>Our parameter evaluated to False, indicating that it is not summer. The following are the elements of this Python statement:<\/p>\n\n\n\n<table class=\"wp-block-table course-info-table\"><tbody><tr><td><strong>Element<\/strong><\/td><td><strong>Example<\/strong><\/td><\/tr><tr><td>variable<\/td><td>\u201cis_summer\u201d<\/td><\/tr><tr><td>operator<\/td><td>\u201c=\u201d<\/td><\/tr><tr><td>value<\/td><td>\u201cFalse\u201d<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p><\/p>\n\n\n\n<p>When programming, we assign the Python Boolean values to a variable; the value can only be equal to True or False.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Comparisons in Python<\/h2>\n\n\n\n<p>Comparisons are a feature of programming that allow you to compare operands and return a True or False value based on the comparison.<\/p>\n\n\n\n<p>For instance, say you are building a program that calculates the tallest building in the world. For your program to work, you may want to compare multiple Python Boolean parameters or values to find out the tallest. To do this, you could use the Boolean data type.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Python Operators<\/h3>\n\n\n\n<p>In addition to arithmetic operators, there are a number of <a href=\"https:\/\/careerkarma.com\/blog\/python-logical-operators\/\">Python logical operators<\/a> and comparison operators. You can use these operators to compare values, or <em>operands. <\/em>A table of the comparison operators and associated Python symbols follows:<\/p>\n\n\n\n<table class=\"wp-block-table course-info-table\"><tbody><tr><td><strong>Comparison Operator<\/strong> <strong>Symbol<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td>==<\/td><td>equal to<\/td><\/tr><tr><td>!=<\/td><td>not equal to<\/td><\/tr><tr><td>&gt;<\/td><td>greater than<\/td><\/tr><tr><td>&lt;<\/td><td>less than<\/td><\/tr><tr><td>&gt;=<\/td><td>greater than or equal to<\/td><\/tr><tr><td>&lt;=<\/td><td>less than or equal to<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>To further illustrate how Booleans work in Python, let\u2019s use another example. Say we own an ice cream store and want to know whether a loyalty member has purchased more than eight pints. This is important because each customer gets a free pint of ice cream after purchasing eight pints.<\/p>\n\n\n\n<p>We could check whether a customer has purchased more than eight pints of ice cream using the following lines of code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>pints_of_ice_cream_purchased = 6\n\nprint(pints_of_ice_cream_purchased &gt; 8)<\/pre><\/div>\n\n\n\n<p>The output of our code is <code>False<\/code>.&nbsp;<\/p>\n\n\n\n<p>As you can see, our program uses the greater than operator to check if our customer has purchased more than eight pints. In this case, our customer has only purchased six pints of ice cream, so our operand evaluated to False.<\/p>\n\n\n\n<p>What if we wanted to check whether our customer has purchased exactly eight pints of ice cream? We could use the equal to (<em>==<\/em>) operator, like this:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>pints_of_ice_cream_purchased = 6\n\nprint(pints_of_ice_cream_purchased == 8)<\/pre><\/div>\n\n\n\n<p>The outcome of our code is <code>False<\/code>.&nbsp;<\/p>\n\n\n\n<p>Because our customer has only purchased six pints of ice cream, our statement <code>pints_of_ice_cream_purchased == 8<\/code> evaluated to <code>False<\/code>. If our customer had purchased eight pints of ice cream, our statement would have evaluated to <code>True<\/code>.<\/p>\n\n\n\n<p>Similarly, Booleans can be used to evaluate the outcome of a string comparison. Say we want to know whether a customer has ordered the <code>Triple Chocolate Fudge<\/code> flavor of ice cream, which is on the secret menu. We could perform this comparison using the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>order = &quot;Triple Chocolate Fudge&quot;\n\nprint(order == &quot;Triple Chocolate Fudge&quot;)<\/pre><\/div>\n\n\n\n<p>The output of our code is <code>True<\/code>.&nbsp;<\/p>\n\n\n\n<p>Our customer has ordered the <code>Triple Chocolate Fudge<\/code> ice cream flavor, so when our program evaluates this, it returns: <code>True<\/code>.&nbsp;<\/p>\n\n\n\n<p>It\u2019s worth noting that string comparisons are case-sensitive. So, if we had input the customer\u2019s order as <code>triple chocolate fudge<\/code>, the above code would have returned <code>False<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Evaluate Variables Using Boolean<\/h2>\n\n\n\n<p>Python includes a built-in function called <code>bool()<\/code> that you can use to evaluate a variable or value. <code>bool()<\/code> takes in one argument: the value or variable you want to evaluate.<\/p>\n\n\n\n<p>Here\u2019s the syntax for the <code>bool()<\/code> method:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>bool(value)<\/pre><\/div>\n\n\n\n<p>The <code>bool()<\/code> method can be useful in a number of cases.<\/p>\n\n\n\n<p>Firstly, if you want to perform any comparison, you can enclose it within the <code>bool()<\/code> method, which returns a Boolean value. For example, say you want to know whether a customer has purchased 50 or more pints of ice cream at your store. If so, you want to send that customer a thank-you card. You could figure this out using the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>pints_of_ice_cream_purchased = 51\n\nprint(bool(pints_of_ice_cream_purchased &gt;= 50))<\/pre><\/div>\n\n\n\n<p>The output of our code is <code>True<\/code>.&nbsp;<\/p>\n\n\n\n<p>Our customer has purchased more than 50 pints of ice cream, so our statement evaluates to <code>True<\/code>. It\u2019s worth noting that you don\u2019t need to use the <code>bool()<\/code> method for a comparison like this. But it can be helpful, as it clearly shows the purpose of your code.<\/p>\n\n\n\n<p>Secondly, if you want to check if a value is empty, None, or False, you can use the <code>bool()<\/code> method. This is the most popular use of the <code>bool()<\/code> method. This method converts a value into a Boolean according to &#8220;standard truth&#8221; testing. So, you can use the method, for example, to convert integers or floating point numbers into Booleans.<\/p>\n\n\n\n<p>Let\u2019s say we have a list of ice cream orders by a loyalty customer. We want to check whether they ordered with their loyalty card. We could perform this evaluation using the following lines of code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>ice_cream_orders = []\n\nprint(bool(ice_cream_orders))<\/pre><\/div>\n\n\n\n<p>Our code returns <code>False<\/code>.&nbsp;<\/p>\n\n\n\n<p>In this case, our loyalty customer has not placed any orders using their card, so our <code>bool()<\/code> method returns <code>False<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Boolean Flow Control<\/h2>\n\n\n\n<p>The Boolean value is an important part of flow control in programming. This is because Booleans evaluate whether a condition is True or False. And that information can be used to judge whether a specific block of code should be run.<\/p>\n\n\n\n<p>In Python, conditional statements in the header line, such as <em>if<\/em> statements, run code if a certain condition or set of conditions is met. These statements only work because Booleans evaluate the condition specified in the statement.<\/p>\n\n\n\n<p>Let\u2019s use an example to illustrate how this works. Say we are creating a program that takes in a customer\u2019s email address and checks whether they are signed up for our rewards program. If the customer is signed up, we want to print a message to the console that states <code>This customer is a Loyalty Customer!<\/code> Otherwise, we want to print <code>No record.<\/code><\/p>\n\n\n\n<p>To do this, we could use the following lines of code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>loyalty_customer = True\n\nif loyalty_customer = True:\n\tprint(&quot;This customer is a Loyalty Customer!&quot;)\nelse:\n\tprint(&quot;No record.&quot;)<\/pre><\/div>\n\n\n\n<p>Our code returns <code>True<\/code>.<\/p>\n\n\n\n<p>In our program, our <code>if<\/code> expression (in the header line) evaluates whether the variable <code>loyalty_customer<\/code> is equal to <code>True<\/code>. If <code>loyalty_customer<\/code> is equal to <code>True<\/code>, the <code>if<\/code> statement will evaluate to <code>True<\/code>. Thus, the message <code>This customer is a Loyalty Customer!<\/code> on the next line will be printed to the console. If <code>loyalty_customer<\/code> is equal to <code>False<\/code>, then the <code>if<\/code> statement will evaluate to <code>False<\/code>. In that case, our program will print <code>No record.<\/code><\/p>\n\n\n\n<p>Booleans allow us to evaluate statements and can be used with conditionals to check whether a certain statement is <code>True<\/code> or <code>False<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Booleans are an important data type in programming that can indicate whether a value is <code>True<\/code> or <code>False<\/code>.<\/p>\n\n\n\n<p>Booleans are often used to evaluate statements using comparison operators and can also be used to control the flow of a program. In addition, Python has a built-in method called <code>bool()<\/code> to check whether an item is empty or equal to None or False.<\/p>\n\n\n\n<p>This tutorial explored comparison operators with Booleans, flow control with Booleans, and the Python <code>bool()<\/code> method. Now you\u2019re equipped with the knowledge you need to work with Booleans in Python like an expert!<\/p>\n","protected":false},"excerpt":{"rendered":"The Python Boolean data type has only two possible states, the keywords False and True. Booleans cannot hold any other value, and are the smallest data type. Booleans are essential to many aspects of programming, like the use of if statements. Note on capitalization. The word Boolean, named after the mathematician George Boole, is always&hellip;","protected":false},"author":240,"featured_media":12841,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-12840","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Python","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python Boolean: A Complete Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"In Python, the Boolean data type allows coders to work with values that can be either true or false. Learn about Python Booleans, how they work, and how you can use them to control program flow, on Career Karma.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/python-boolean\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Boolean: A Complete Guide\" \/>\n<meta property=\"og:description\" content=\"In Python, the Boolean data type allows coders to work with values that can be either true or false. Learn about Python Booleans, how they work, and how you can use them to control program flow, on Career Karma.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-boolean\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-12T21:35:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:59:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"800\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python Boolean: A Complete Guide\",\"datePublished\":\"2020-09-12T21:35:27+00:00\",\"dateModified\":\"2023-12-01T11:59:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/\"},\"wordCount\":1252,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-boolean\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/\",\"name\":\"Python Boolean: A Complete Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg\",\"datePublished\":\"2020-09-12T21:35:27+00:00\",\"dateModified\":\"2023-12-01T11:59:38+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"In Python, the Boolean data type allows coders to work with values that can be either true or false. Learn about Python Booleans, how they work, and how you can use them to control program flow, on Career Karma.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-boolean\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg\",\"width\":1200,\"height\":800},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-boolean\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/careerkarma.com\/blog\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python Boolean: A Complete Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Boolean: A Complete Guide | Career Karma","description":"In Python, the Boolean data type allows coders to work with values that can be either true or false. Learn about Python Booleans, how they work, and how you can use them to control program flow, on Career Karma.","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:\/\/careerkarma.com\/blog\/python-boolean\/","og_locale":"en_US","og_type":"article","og_title":"Python Boolean: A Complete Guide","og_description":"In Python, the Boolean data type allows coders to work with values that can be either true or false. Learn about Python Booleans, how they work, and how you can use them to control program flow, on Career Karma.","og_url":"https:\/\/careerkarma.com\/blog\/python-boolean\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-09-12T21:35:27+00:00","article_modified_time":"2023-12-01T11:59:38+00:00","og_image":[{"width":1200,"height":800,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/python-boolean\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-boolean\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python Boolean: A Complete Guide","datePublished":"2020-09-12T21:35:27+00:00","dateModified":"2023-12-01T11:59:38+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-boolean\/"},"wordCount":1252,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-boolean\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-boolean\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-boolean\/","url":"https:\/\/careerkarma.com\/blog\/python-boolean\/","name":"Python Boolean: A Complete Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-boolean\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-boolean\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg","datePublished":"2020-09-12T21:35:27+00:00","dateModified":"2023-12-01T11:59:38+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"In Python, the Boolean data type allows coders to work with values that can be either true or false. Learn about Python Booleans, how they work, and how you can use them to control program flow, on Career Karma.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-boolean\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-boolean\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-boolean\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg","width":1200,"height":800},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-boolean\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/careerkarma.com\/blog\/python\/"},{"@type":"ListItem","position":3,"name":"Python Boolean: A Complete Guide"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/12840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=12840"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/12840\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/12841"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=12840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=12840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=12840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}