{"id":5338,"date":"2021-05-06T13:53:31","date_gmt":"2021-05-06T08:23:31","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=5338"},"modified":"2021-06-14T15:05:20","modified_gmt":"2021-06-14T09:35:20","slug":"if-not-python","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/if-not-python\/","title":{"rendered":"Simplifying If Not Logical Operation in Python"},"content":{"rendered":"\n<p>If not Python is a logical operator which is present in pre-built statements. Operators help in performing different functions or actions that are important to get a result. Python allows us to perform different actions.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#What_is_an_If_Not_Python_Operation\" >What is an If Not Python Operation?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#How_do_you_Write_if_not_Condition_in_Python\" >How do you Write if not Condition in Python?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#Syntax\" >Syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#Parameter\" >Parameter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#Examples_of_If_Not_Statement_in_Python\" >Examples of If Not Statement in Python<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#1_If_Not_Python_on_Boolean\" >1. If Not Python on Boolean<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#2_If_Not_Python_on_String\" >2. If Not Python on String<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#3_If_Not_on_a_List\" >3. If Not on a List<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#4_If_Not_Python_on_Dictionary\" >4. If Not Python on Dictionary<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#5_If_Not_on_Set\" >5. If Not on Set<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#6_If_Not_Python_on_Tuple\" >6. If Not Python on Tuple<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#FAQs\" >FAQs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#See_Also\" >See Also<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-what-is-an-if-not-python-operation\"><span class=\"ez-toc-section\" id=\"What_is_an_If_Not_Python_Operation\"><\/span>What is an If Not Python Operation?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>Python If Not Operator is a combination of &#8216;if&#8217; and &#8216;not&#8217; statements. &#8216;if&#8217; keyword allows you to check if the condition of the next statements is True or False and then act accordingly. Whereas the &#8216;not&#8217; keyword negates the value of boolean of statements in front of it. Moreover, the &#8216;if not&#8217; statement allows you to avoid the &#8216;else&#8217; keyword many times.<\/strong><\/p>\n\n\n\n<p>In this topic, we will be discussing the if-not operator. It can operate on boolean, string, list, dictionary, and sets. We can obtain negative values using the operator. This means that when we use \u201cif not\u201d and the output is true, then the result is shown as false. The same happens for vice-versa. In other words, if the value is false the not value will be true and if the value is true then the not value will be false.<\/p>\n\n\n\n<p>This entire situation happens for the Boolean type. Let us take a string expression. Here the operator will only function when string values are empty. This is similar to the list as well. If the list is empty, only then the operator can perform.<\/p>\n\n\n\n<p>Some of operators are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Arithmetic operators<\/strong> &#8211; They help in arithmetic calculations like addition, <a href=\"http:\/\/www.pythonpool.com\/numpy-subtract\/\" target=\"_blank\" rel=\"noreferrer noopener\">subtraction<\/a>, multiplication, and division.<\/li><li><strong>Assignment operators<\/strong> &#8211; We can use this to assign a value to a variable.<\/li><li><strong>Comparison operators<\/strong> &#8211; They can compare two or more variables and obtain a relative result.<\/li><li><strong>Logical operators<\/strong> &#8211; They can perform logical operations based on logic.<\/li><li><strong>Identity operators<\/strong> &#8211; They are used to compare two objects if they belong to the same memory area.<\/li><li><strong>Membership operators<\/strong> &#8211; They can test if a sequence is present in the program.<\/li><li><strong>Bitwise operators<\/strong> &#8211; It checks for the relation in binary values.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-do-you-write-if-not-condition-in-python\"><span class=\"ez-toc-section\" id=\"How_do_you_Write_if_not_Condition_in_Python\"><\/span>How do you Write if not Condition in Python?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The following syntax refers to how the interpreter expects to parse if not condition in your program:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if&lt;space&gt;not&lt;space&gt;condition:\n&lt;indentation&gt;statement\n\n# Example:\n\nif not x==5:\n    print(\"x is not 5\")<\/code><\/pre>\n\n\n\n<p>Source: <a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#index-6\">Python Official Documentation<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-syntax\"><span class=\"ez-toc-section\" id=\"Syntax\"><\/span><strong>Syntax<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nif not value:\n    statement(s)\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-parameter\"><span class=\"ez-toc-section\" id=\"Parameter\"><\/span>Parameter<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Not applicable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-examples-of-if-not-statement-in-python\"><span class=\"ez-toc-section\" id=\"Examples_of_If_Not_Statement_in_Python\"><\/span>Examples of If Not Statement in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-if-not-python-on-boolean\"><span class=\"ez-toc-section\" id=\"1_If_Not_Python_on_Boolean\"><\/span>1. If Not Python on Boolean<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Boolean values are usually 0 and 1.Zero can be written as false and 1 means true in a programming code.<\/p>\n\n\n\n<p><strong>SYNTAX<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nCHECK = False\n\nif not CHECK:\n       print('false.')\n \nCHECK = 5\n\nif not CHECK==5:\n       print('CHECK is not 5')\nelse:\n       print('CHECK is 5')\n<\/pre><\/div>\n\n\n<p><strong>OUTPUT<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>false\nCHECK is 5<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-2-if-not-python-on-string\"><span class=\"ez-toc-section\" id=\"2_If_Not_Python_on_String\"><\/span>2. If Not Python on String<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>String refers to the set of zeros or sequence of text. We store strings in double-quotes.<\/p>\n\n\n\n<p><strong>SYNTAX<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nstring = &quot;&quot;\n \nif not string:\n    print('String is empty.')\nelse:\n    print(string)\n<\/pre><\/div>\n\n\n<p><strong>OUTPUT<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>String is empty<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-if-not-on-a-list\"><span class=\"ez-toc-section\" id=\"3_If_Not_on_a_List\"><\/span>3. If Not on a List<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The list can store multiple data in a single variable. The list is usually very versatile in Python as it has multiplet set of data of varied types.<\/p>\n\n\n\n<p><strong>SYNTAX<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ncheck= &#x5B;]\n \nif not check:\n    print('List is empty.')\nelse:\n    print(check)\n<\/pre><\/div>\n\n\n<p><strong>OUTPUT<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>List is empty<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-4-if-not-python-on-dictionary\"><span class=\"ez-toc-section\" id=\"4_If_Not_Python_on_Dictionary\"><\/span>4. If Not Python on Dictionary<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>It is a collection of unordered and changed data. The dictionary uses index value to recognize the data. It uses the logical operator to check if the dictionary is empty. Dictionary values contain keys and values. We write them in braces.<\/p>\n\n\n\n<p><strong>SYNTAX<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nval = dict({})\n\nif not val:\n    print('Dictionary is empty.')\nelse:\n    print(val)\n<\/pre><\/div>\n\n\n<p><strong>OUTPUT<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Dictionary is empty.<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-5-if-not-on-set\"><span class=\"ez-toc-section\" id=\"5_If_Not_on_Set\"><\/span>5. If Not on Set<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Set is different from the dictionary. It is a collection of unordered data. They do not contain any index value. We can write to them in curly braces. We cannot use the index using a key or index value. The values in the set are usually used along with the loop. The set allows us to add and update values.<\/p>\n\n\n\n<p><strong>SYNTAX<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nval = set({})\n\nif not val:\n    print('Set is empty.')\nelse:\n    print(a)\n<\/pre><\/div>\n\n\n<p><strong>OUTPUT<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Set is empty.<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-6-if-not-python-on-tuple\"><span class=\"ez-toc-section\" id=\"6_If_Not_Python_on_Tuple\"><\/span>6. If Not Python on Tuple<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The tuples are same as that of lists. They are a finite list of values. The sequence is in order and immutable.<\/p>\n\n\n\n<p><strong>SYNTAX<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nVal = tuple()\n\nif not val:\n    print('Tuple is empty.')\nelse:\n    print(val)\n<\/pre><\/div>\n\n\n<p><strong>OUTPUT<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Tuple is empty.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-faqs\"><span class=\"ez-toc-section\" id=\"FAQs\"><\/span>FAQs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1620139121086\"><strong class=\"schema-faq-question\">Is != Valid in Python?<\/strong> <p class=\"schema-faq-answer\">Yes. != is an expression for &#8216;not equals&#8217; in layman terms. Moreover, you can use the &#8216;not&#8217; keyword to keep your code clean and remove any existing &#8216;!=&#8217;.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1620189815251\"><strong class=\"schema-faq-question\">Is not and != in Python same?<\/strong> <p class=\"schema-faq-answer\">Technically No. != checks if the two objects have the same value, whereas is not keyword compares the memory of two objects.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1620189867681\"><strong class=\"schema-faq-question\">Is not equal to Python?<\/strong> <p class=\"schema-faq-answer\">Is not is a famous keyword that is used instead of != in Python. It compares the memory locations of two objects and returns True if those are the same. Beware: Is not checks the memory while != checks the value. Choose Wisely!<\/p> <\/div> <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-see-also\"><span class=\"ez-toc-section\" id=\"See_Also\"><\/span>See Also<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-yoast-seo-related-links\"><li><a href=\"http:\/\/www.pythonpool.com\/not-in-python\/\">Not in Python | With Uses and In-Depth Explanation<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/python-any\/\">Python Any | [Explained] any() Function in Python<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/python-negate-boolean\/\">Is it Possible to Negate a Boolean in Python? [Answered]<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/python-string-__contains__\/\">Best Ways to Use Python String __contains__() Method<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/numpy-any\/\">Numpy any | Comprehensive Showcase of Boolean Analyser<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The if-not clearly shows the versatile nature of Python as a language. Without this logical operator, it would become difficult to check if the list, string,  or tuple is empty.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If not Python is a logical operator which is present in pre-built statements. Operators help in performing different functions or actions that are important to &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Simplifying If Not Logical Operation in Python\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/#more-5338\" aria-label=\"More on Simplifying If Not Logical Operation in Python\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":11092,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[15],"tags":[3943,1257,1259,3942,3944,3941,1268,1265],"class_list":["post-5338","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-if-not-equal-python","tag-if-not-in-list-python","tag-if-not-in-python","tag-if-not-python","tag-python-if-not","tag-python-if-not-equal","tag-python-if-not-in","tag-python-if-not-in-list","infinite-scroll-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v25.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Simplifying If Not Logical Operation in Python - Python Pool<\/title>\n<meta name=\"description\" content=\"If not python is a logical operator that is used by python programming language to provide a negation output.It can be used on various data.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/if-not-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Simplifying If Not Logical Operation in Python\" \/>\n<meta property=\"og:description\" content=\"If not Python is a logical operator which is present in pre-built statements. Operators help in performing different functions or actions that are\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/if-not-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-06T08:23:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-14T09:35:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/If-Not-Python-Logical-Operator.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1350\" \/>\n\t<meta property=\"og:image:height\" content=\"650\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Python Pool\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Python Pool\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/\"},\"author\":{\"name\":\"Python Pool\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998\"},\"headline\":\"Simplifying If Not Logical Operation in Python\",\"datePublished\":\"2021-05-06T08:23:31+00:00\",\"dateModified\":\"2021-06-14T09:35:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/\"},\"wordCount\":782,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/If-Not-Python-Logical-Operator.jpg\",\"keywords\":[\"if not equal python\",\"if not in list python\",\"if not in python\",\"if not python\",\"python if not\",\"python if not equal\",\"python if not in\",\"python if not in list\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/if-not-python\/#respond\"]}]},{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/\",\"url\":\"https:\/\/www.pythonpool.com\/if-not-python\/\",\"name\":\"Simplifying If Not Logical Operation in Python - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/If-Not-Python-Logical-Operator.jpg\",\"datePublished\":\"2021-05-06T08:23:31+00:00\",\"dateModified\":\"2021-06-14T09:35:20+00:00\",\"description\":\"If not python is a logical operator that is used by python programming language to provide a negation output.It can be used on various data.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#breadcrumb\"},\"mainEntity\":[{\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620139121086\"},{\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189815251\"},{\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189867681\"}],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/if-not-python\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/If-Not-Python-Logical-Operator.jpg\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/If-Not-Python-Logical-Operator.jpg\",\"width\":1350,\"height\":650,\"caption\":\"if not python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Simplifying If Not Logical Operation in Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998\",\"name\":\"Python Pool\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fdd3cb9ad7f560324dfd481989550aa8ffce84388fd253c42beca35c999d3108?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/fdd3cb9ad7f560324dfd481989550aa8ffce84388fd253c42beca35c999d3108?s=96&d=wavatar&r=g\",\"caption\":\"Python Pool\"}},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620139121086\",\"position\":1,\"url\":\"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620139121086\",\"name\":\"Is != Valid in Python?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Yes. != is an expression for 'not equals' in layman terms. Moreover, you can use the 'not' keyword to keep your code clean and remove any existing '!='.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189815251\",\"position\":2,\"url\":\"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189815251\",\"name\":\"Is not and != in Python same?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Technically No. != checks if the two objects have the same value, whereas is not keyword compares the memory of two objects.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189867681\",\"position\":3,\"url\":\"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189867681\",\"name\":\"Is not equal to Python?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Is not is a famous keyword that is used instead of != in Python. It compares the memory locations of two objects and returns True if those are the same. Beware: Is not checks the memory while != checks the value. Choose Wisely!\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Simplifying If Not Logical Operation in Python - Python Pool","description":"If not python is a logical operator that is used by python programming language to provide a negation output.It can be used on various data.","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:\/\/www.pythonpool.com\/if-not-python\/","og_locale":"en_US","og_type":"article","og_title":"Simplifying If Not Logical Operation in Python","og_description":"If not Python is a logical operator which is present in pre-built statements. Operators help in performing different functions or actions that are","og_url":"https:\/\/www.pythonpool.com\/if-not-python\/","og_site_name":"Python Pool","article_published_time":"2021-05-06T08:23:31+00:00","article_modified_time":"2021-06-14T09:35:20+00:00","og_image":[{"width":1350,"height":650,"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/If-Not-Python-Logical-Operator.jpg","type":"image\/jpeg"}],"author":"Python Pool","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Python Pool","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pythonpool.com\/if-not-python\/#article","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/if-not-python\/"},"author":{"name":"Python Pool","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998"},"headline":"Simplifying If Not Logical Operation in Python","datePublished":"2021-05-06T08:23:31+00:00","dateModified":"2021-06-14T09:35:20+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/if-not-python\/"},"wordCount":782,"commentCount":0,"publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/www.pythonpool.com\/if-not-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/If-Not-Python-Logical-Operator.jpg","keywords":["if not equal python","if not in list python","if not in python","if not python","python if not","python if not equal","python if not in","python if not in list"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pythonpool.com\/if-not-python\/#respond"]}]},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/www.pythonpool.com\/if-not-python\/","url":"https:\/\/www.pythonpool.com\/if-not-python\/","name":"Simplifying If Not Logical Operation in Python - Python Pool","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pythonpool.com\/if-not-python\/#primaryimage"},"image":{"@id":"https:\/\/www.pythonpool.com\/if-not-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/If-Not-Python-Logical-Operator.jpg","datePublished":"2021-05-06T08:23:31+00:00","dateModified":"2021-06-14T09:35:20+00:00","description":"If not python is a logical operator that is used by python programming language to provide a negation output.It can be used on various data.","breadcrumb":{"@id":"https:\/\/www.pythonpool.com\/if-not-python\/#breadcrumb"},"mainEntity":[{"@id":"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620139121086"},{"@id":"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189815251"},{"@id":"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189867681"}],"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pythonpool.com\/if-not-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/if-not-python\/#primaryimage","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/If-Not-Python-Logical-Operator.jpg","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/If-Not-Python-Logical-Operator.jpg","width":1350,"height":650,"caption":"if not python"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pythonpool.com\/if-not-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"Simplifying If Not Logical Operation in Python"}]},{"@type":"WebSite","@id":"https:\/\/www.pythonpool.com\/#website","url":"https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/pythonpool","https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998","name":"Python Pool","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/fdd3cb9ad7f560324dfd481989550aa8ffce84388fd253c42beca35c999d3108?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fdd3cb9ad7f560324dfd481989550aa8ffce84388fd253c42beca35c999d3108?s=96&d=wavatar&r=g","caption":"Python Pool"}},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620139121086","position":1,"url":"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620139121086","name":"Is != Valid in Python?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Yes. != is an expression for 'not equals' in layman terms. Moreover, you can use the 'not' keyword to keep your code clean and remove any existing '!='.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189815251","position":2,"url":"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189815251","name":"Is not and != in Python same?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Technically No. != checks if the two objects have the same value, whereas is not keyword compares the memory of two objects.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189867681","position":3,"url":"https:\/\/www.pythonpool.com\/if-not-python\/#faq-question-1620189867681","name":"Is not equal to Python?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Is not is a famous keyword that is used instead of != in Python. It compares the memory locations of two objects and returns True if those are the same. Beware: Is not checks the memory while != checks the value. Choose Wisely!","inLanguage":"en-US"},"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/5338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=5338"}],"version-history":[{"count":16,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/5338\/revisions"}],"predecessor-version":[{"id":13494,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/5338\/revisions\/13494"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/11092"}],"wp:attachment":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=5338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=5338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=5338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}