{"id":1040,"date":"2021-11-30T11:46:25","date_gmt":"2021-11-30T11:46:25","guid":{"rendered":"https:\/\/ethosspace.com\/programmers\/?p=1040"},"modified":"2021-11-30T11:46:26","modified_gmt":"2021-11-30T11:46:26","slug":"not-equal-to-in-python-using-operator","status":"publish","type":"post","link":"https:\/\/ethosspace.com\/programmers\/not-equal-to-in-python-using-operator\/","title":{"rendered":"Not equal to in python using != operator"},"content":{"rendered":"\n<p>To check if two operands are not equal python provides operator !=.<\/p>\n\n\n\n<p>Let&#8217;s see an example of not equal to an operator on an integer variable.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>#Use of operator not equal to\na= &quot;3&quot;\nb= &quot;4&quot;\nc = &quot;4&quot;\n#If a is not equal to b then conditon will print true\nprint(&quot;a=&quot;,a,&quot;b=&quot;,b,&quot;\\nResult of Not Equal to Operator is &quot;,a!=b)\nprint(&quot;\\n&quot;)\n#if c equal to b then condition will print false as we are using not equal to operator\nprint(&quot; b=&quot;,b,&quot;c=&quot;,c,&quot;\\nResult of Not Equal to Operator is  &quot;,b!=c)\nprint(&quot;\\n&quot;)<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>a= 3 b= 4 \nResult of Not Equal to Operator is  True\n\n\n b= 4 c= 4 \nResult of Not Equal to Operator is   False\n<\/code><\/pre><\/div>\n\n\n\n<p>Similarly, we can apply not equal to an operator on a variable that contains string values. <\/p>\n\n\n\n<p>!= Operator return value as True when the value of operands are different. If both operands are the same then Not Equal to the operator will return False.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>#Let&#39;s See with String value\nstr1= &quot;ethosspace.com&quot;\nstr2= &quot;google.com&quot;\nstr3 = &quot;google.com&quot;\n#If str1 is not equal to str2 then conditon will print true\nprint(&quot;str1=&quot;,str1,&quot;str2=&quot;,str2,&quot;\\nResult of Not Equal to Operator is &quot;,str1!=str2)\nprint(&quot;\\n&quot;)\n#if str3 equal to str2 then condition will print false as we are using not equal to operator\nprint(&quot; str2=&quot;,str2,&quot;str3=&quot;,str3,&quot;\\nResult of Not Equal to Operator is  &quot;,str2!=str3)<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>str1= ethosspace.com str2= google.com \nResult of Not Equal to Operator is  True\n\n\n str2= google.com str3= google.com \nResult of Not Equal to Operator is   False\n<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>To check if two operands are not equal python provides operator !=. Let&#8217;s see an example of not equal to an operator on an integer variable. Similarly, we can apply not equal to an operator on a variable that contains string values. != Operator return value as True when the value of operands are different. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[11],"tags":[],"class_list":["post-1040","post","type-post","status-publish","format-standard","hentry","category-running-code-and-program"],"aioseo_notices":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"sparkling-featured":false,"sparkling-featured-fullwidth":false,"tab-small":false},"uagb_author_info":{"display_name":"program45_-rt8nb","author_link":"https:\/\/ethosspace.com\/programmers\/author\/program45_-rt8nb\/"},"uagb_comment_info":0,"uagb_excerpt":"To check if two operands are not equal python provides operator !=. Let&#8217;s see an example of not equal to an operator on an integer variable. Similarly, we can apply not equal to an operator on a variable that contains string values. != Operator return value as True when the value of operands are different.&hellip;","_links":{"self":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/1040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/comments?post=1040"}],"version-history":[{"count":1,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/1040\/revisions"}],"predecessor-version":[{"id":1041,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/1040\/revisions\/1041"}],"wp:attachment":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/media?parent=1040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/categories?post=1040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/tags?post=1040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}