

{"id":5357,"date":"2017-12-20T06:58:13","date_gmt":"2017-12-20T01:28:13","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=5357"},"modified":"2026-04-21T15:06:33","modified_gmt":"2026-04-21T09:36:33","slug":"python-decision-making-expressions","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/","title":{"rendered":"Python If, If-else, Nested Statements &#8211; Python Decision Making Statements"},"content":{"rendered":"<p>Today, we talk about <strong>Python <\/strong>decision-making constructs.\u00a0 This includes Python if statements, if else statements, elif statements, nested if conditions, and single statement conditions.<\/p>\n<p>We will understand these with syntax and examples to get a clear understanding.<\/p>\n<p>So, let&#8217;s start the Python Decision-Making Tutorial.<\/p>\n<h3>What are Python Decision-Making Statements?<\/h3>\n<p>Before we begin with Python decision-making expressions, let us review Python concepts.<\/p>\n<p>Sometimes, in a program, we may want to make a decision based on a condition. We know that an expression\u2019s value can be True or False. We may want to do something only when a certain condition is true.<\/p>\n<p><strong>Advantages of decision-making statements in Python:<\/strong><\/p>\n<ul>\n<li><strong>Interaction:<\/strong> The computer guides the user on what he is doing, like showing a wrong password message if the password is wrong.<\/li>\n<li><strong>Clean and tidy:<\/strong> By using statements, you can keep your code organized and easy to read.<\/li>\n<li><strong>Efficient:<\/strong> It makes sure that the program runs faster as it avoids working on parts that are not required.<\/li>\n<li><strong>Safety network:<\/strong> In a program, it is made sure that if an unexpected problem occurs, there is a backup.<\/li>\n<\/ul>\n<p>Let us see at various Python decision-making expressions in detail with syntax and examples. So let&#8217;s install Python on Windows first and review Python syntax for programming in Python.<\/p>\n<h4>Python if Statements<\/h4>\n<p>An if statement in Python takes an expression with it. If the expression amounts to True, then the block of statements under it is executed.<\/p>\n<p>If it amounts to False, then the block is skipped and control transfers to the statements after the block. But remember to indent the statements in a block equally.<\/p>\n<p>This is because we don\u2019t use curly braces to delimit blocks. Also, use a colon(:) after the condition.<\/p>\n<div id=\"attachment_5361\" style=\"width: 810px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-Statements.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5361\" class=\"wp-image-5361 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-Statements.jpg\" alt=\"If statements in Python\" width=\"800\" height=\"800\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-Statements.jpg 800w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-Statements-150x150.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-Statements-300x300.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-Statements-768x768.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-Statements-100x100.jpg 100w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><p id=\"caption-attachment-5361\" class=\"wp-caption-text\">Python Decision Making &#8211; Python if Statement<\/p><\/div>\n<p>Before starting with the example, let us see various types of variables and data types in Python as it will help in better programming.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">a=7\r\nif a&gt;6:\r\n     print(f\"{a} is good\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">7 is good<\/div>\n<p>Here, since 7&gt;6, the condition is true. So, it prints the given string.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">if 1:\r\n    print(\"yay\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">yay<\/div>\n<p>We know, 1 has a Boolean value of True. So, the condition is true, and it prints \u2018yay\u2019.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">if(1==1):\r\n   print(\"1\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">1<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt;<\/pre>\n<p>You can also write the condition in parentheses. It does not cause a syntax error.<\/p>\n<h4>Python if-else Statements<\/h4>\n<p>What happens when the condition is untrue? We can mention that it is in the block after the else statement. An else statement comes right after the block after \u2018if\u2019.<\/p>\n<div id=\"attachment_5360\" style=\"width: 810px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-else-Statements.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5360\" class=\"wp-image-5360 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-else-Statements.jpg\" alt=\"if else Statements Python\" width=\"800\" height=\"800\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-else-Statements.jpg 800w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-else-Statements-150x150.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-else-Statements-300x300.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-else-Statements-768x768.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/if-else-Statements-100x100.jpg 100w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><p id=\"caption-attachment-5360\" class=\"wp-caption-text\">Python Decision Making &#8211; Python if-else Statement<\/p><\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">if 2&lt;1:\r\n     print(\"2\")\r\n     else:\r\nSyntaxError: Invalid syntax\r\nif 2&lt;1:\r\n     print(\"2\")\r\nelse:\r\n     print(\"1\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">1<\/div>\n<p>Pay attention to the indent. The else keyword does not appear in the if-block.<\/p>\n<p>Press Backspace to undo the automatic indent. Here, 2 is not less than 1. So, the statements in the else-block are executed. It prints 1.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">if 2&lt;1:\r\n    print(\"2\")\r\nelse:\r\n    print(\"1\")\r\nelse:\r\nSyntaxError: invalid syntax\r\n&gt;&gt;&gt;<\/pre>\n<p>As appears in the above example, you cannot posit two else statements under an if. It causes a syntax error.<\/p>\n<h4>Chained Conditionals (elif ladder)<\/h4>\n<p>Python allows the elif keyword as a replacement to the else-if statements in Java or C++. When we have more than one condition to check, we can use it.<\/p>\n<p>If condition 1 isn\u2019t True, condition 2 is checked. If it isn\u2019t true, condition 3 is checked.<\/p>\n<div id=\"attachment_5359\" style=\"width: 810px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Chained-Conditionals.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5359\" class=\"wp-image-5359 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Chained-Conditionals.jpg\" alt=\"elif condition in python\" width=\"800\" height=\"800\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Chained-Conditionals.jpg 800w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Chained-Conditionals-150x150.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Chained-Conditionals-300x300.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Chained-Conditionals-768x768.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Chained-Conditionals-100x100.jpg 100w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><p id=\"caption-attachment-5359\" class=\"wp-caption-text\">Python Decision Making Statements &#8211; Python Chained Operators<\/p><\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">if 2&lt;1:\r\n     print(\"2\")\r\n     else if 3&lt;1:\r\nSyntaxError: invalid syntax\r\nif 2&lt;1:\r\n     print(\"2\")\r\nelif 1&lt;3:\r\n     print(\"1\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">1<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">if 2&lt;1:\r\n     print(\"2\")\r\nelif 3&lt;1:\r\n     print(\"3\")\r\nelse:\r\n     print(\"1\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">1<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt;<\/pre>\n<p>As we saw, else if causes a syntax error. We must use elif. Here, 2 is not less than 1, so, the condition with elif is checked.<\/p>\n<p>Since it is true (1&lt;3), it prints 1. Also, you can put an else statement after your elif statements if you want. Since in the last example, the first two conditions are false, the else is executed. So, it prints 1.<\/p>\n<h4>Nested if Statements in Python<\/h4>\n<p>You can put an if statement in the block under another if statement. This is to implement further checks.<\/p>\n<div id=\"attachment_5362\" style=\"width: 810px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Nested-if-Statements.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5362\" class=\"wp-image-5362 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Nested-if-Statements.jpg\" alt=\"Nested if statement in python\" width=\"800\" height=\"800\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Nested-if-Statements.jpg 800w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Nested-if-Statements-150x150.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Nested-if-Statements-300x300.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Nested-if-Statements-768x768.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Nested-if-Statements-100x100.jpg 100w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><p id=\"caption-attachment-5362\" class=\"wp-caption-text\">Python Decision Making &#8211; Nested if Statements in Python<\/p><\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt;a=1\r\n&gt;&gt;&gt;b=2\r\n&gt;&gt;&gt;if a==1:\r\n         if b==2:\r\n               print(\"a is 1 and b is 2\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">a is 1 and b is 2<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt;<\/pre>\n<p>Here, a is 1. So, b is checked. Since it is 2, it prints the given string. Not every if block has to have statements, though.<\/p>\n<h4>Single Statement Condition in Python<\/h4>\n<p>If you only need to write a single statement under if, you can write it in the same line using single-statement Python decision-making constructs.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">a=7\r\nif a&gt;4: print(\"Greater\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">Greater<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt;<\/pre>\n<p>Here, we wrote it in one line, but it works without a problem.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">if a&gt;4: print(\"Hi\"); print(\"Works\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">Hi<br \/>\nWorks<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt;<\/pre>\n<p>You can also use semicolons to write more than one statement in the same line as the condition. However, this may affect the readability of your code.<\/p>\n<p>So, this was all about Python Decision-Making Statements. Hope you like our explanation.<\/p>\n<h3>Python Interview Questions on Decision-Making Statements<\/h3>\n<p>1. What is a decision-making statement in Python?<\/p>\n<p>2. How do you make a decision in Python?<\/p>\n<p>3. How many types of decision-making statements are there in Python?<\/p>\n<p>4. What is an Elif statement in Python?<\/p>\n<p>5. Can you have two if statements in Python?<\/p>\n<h3>Conclusion<\/h3>\n<p>Decision-making in Python centers on the if, elif, and else keywords, which steer the route your program walks based on boolean tests. A clear condition checks the value of variables, the length of lists, or the truth of function calls, and then runs only the branch that passes. Compound conditions use and and or to tie tests together, while the walrus operator,: =, can store a value inside the if line itself, saving a lookup.<\/p>\n<p>We have discussed all these statements with syntax and examples for better understanding. They allow us to make decisions in Python so that we can choose a set of statements to execute.<\/p>\n<p>Don\u2019t forget to try your own combinations in the shell.<\/p>\n<p>Furthermore, if you have any queries, feel free to share them with us!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, we talk about Python decision-making constructs.\u00a0 This includes Python if statements, if else statements, elif statements, nested if conditions, and single statement conditions. We will understand these with syntax and examples to get&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":42117,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[16456,16457,3621,3624,10472,10473,23767,23766],"class_list":["post-5357","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-decision-making-constructs","tag-decision-making-expression","tag-decision-making-in-python","tag-decision-making-statements-in-python","tag-python-decision-making-expressions","tag-python-decision-making-statements","tag-python-if-else-statements","tag-python-if-statements"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python If, If-else, Nested Statements - Python Decision Making Statements - DataFlair<\/title>\n<meta name=\"description\" content=\"Python decision making statements with syntax and examples: Python if statement, Python if else statement,Python elif ladder, Python nested if statement\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python If, If-else, Nested Statements - Python Decision Making Statements - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Python decision making statements with syntax and examples: Python if statement, Python if else statement,Python elif ladder, Python nested if statement\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-20T01:28:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-21T09:36:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Decision-Making-2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python If, If-else, Nested Statements - Python Decision Making Statements - DataFlair","description":"Python decision making statements with syntax and examples: Python if statement, Python if else statement,Python elif ladder, Python nested if statement","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:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/","og_locale":"en_US","og_type":"article","og_title":"Python If, If-else, Nested Statements - Python Decision Making Statements - DataFlair","og_description":"Python decision making statements with syntax and examples: Python if statement, Python if else statement,Python elif ladder, Python nested if statement","og_url":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2017-12-20T01:28:13+00:00","article_modified_time":"2026-04-21T09:36:33+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Decision-Making-2.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python If, If-else, Nested Statements &#8211; Python Decision Making Statements","datePublished":"2017-12-20T01:28:13+00:00","dateModified":"2026-04-21T09:36:33+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/"},"wordCount":957,"commentCount":6,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Decision-Making-2.jpg","keywords":["Decision making Constructs","Decision making expression","decision making in python","decision making statements in python","Python decision making expressions","Python decision making statements","Python if else statements","Python if statements"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/","url":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/","name":"Python If, If-else, Nested Statements - Python Decision Making Statements - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Decision-Making-2.jpg","datePublished":"2017-12-20T01:28:13+00:00","dateModified":"2026-04-21T09:36:33+00:00","description":"Python decision making statements with syntax and examples: Python if statement, Python if else statement,Python elif ladder, Python nested if statement","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Decision-Making-2.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Decision-Making-2.jpg","width":1200,"height":628,"caption":"Python Decision Making Statements - Python If, If-else, Nested Statements"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-decision-making-expressions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python If, If-else, Nested Statements &#8211; Python Decision Making Statements"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=5357"}],"version-history":[{"count":17,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5357\/revisions"}],"predecessor-version":[{"id":147750,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5357\/revisions\/147750"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/42117"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=5357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=5357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=5357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}