{"id":1848,"date":"2019-06-05T19:28:17","date_gmt":"2019-06-05T19:28:17","guid":{"rendered":"http:\/\/wiki.thomasandsofia.com\/?p=1848"},"modified":"2019-06-05T20:07:00","modified_gmt":"2019-06-05T20:07:00","slug":"1848","status":"publish","type":"post","link":"https:\/\/wiki.thomasandsofia.com\/?p=1848","title":{"rendered":"Section 4: Python Comparison Operators"},"content":{"rendered":"<h1>Section 4 Menu<\/h1>\n<p><a href=\"http:\/\/wiki.thomasandsofia.com\/?p=1816\">&lt; Section 3<\/a><br \/>\nSection 5 &gt;<\/p>\n<ol start=\"31\">\n<li>Comparison Operators in Python<\/li>\n<li>Chaining Comparison Operators in Python with Logical Operators<\/li>\n<li>Quiz<\/li>\n<\/ol>\n<h1>Comparison Operators in Python<\/h1>\n<p><a href=\"https:\/\/www.udemy.com\/complete-python-bootcamp\/learn\/lecture\/9407954#content\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/complete-python-bootcamp\/learn\/lecture\/9407954#content<\/a><\/p>\n<table>\n<tbody>\n<tr>\n<th>Operator<\/th>\n<th>Description<\/th>\n<th>Example&gt;<\/th>\n<\/tr>\n<tr>\n<td>==<\/td>\n<td>Equals<\/td>\n<td>1 == 1 (True)<br \/>\n1 == 2 (False)<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td>!=<\/td>\n<td>Not Equal<\/td>\n<td>1 != 1 (False)<br \/>\n1 != 2 (True)<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td>&lt;<\/td>\n<td>Less Than<\/td>\n<td>1 &lt; 2 (True)<br \/>\n2 &lt; 1 (False)<br \/>\n1 &lt; 1 (False)<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td>&lt;=<\/td>\n<td>Less Than or Equal to<\/td>\n<td>1 &lt;= 2 (True)<br \/>\n2 &lt;= 1 (False)<br \/>\n1 &lt;= 1 (True)<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td>&gt;<\/td>\n<td>Greater Than<\/td>\n<td>1 &gt; 2 (False)<br \/>\n2 &gt; 1 (True)<br \/>\n1 &gt; 1 (False)<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td>&gt;=<\/td>\n<td>Greater Than or Equal to<\/td>\n<td>1 &gt;= 2 (False)<br \/>\n2 &gt;= 1 (True)<br \/>\n1 &gt;= 1 (True)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h1>Chaining Comparison Operators in Python with Logical Operators<\/h1>\n<p><a href=\"https:\/\/www.udemy.com\/complete-python-bootcamp\/learn\/lecture\/9407956#content\" target=\"_blank\" rel=\"noopener\">https:\/\/www.udemy.com\/complete-python-bootcamp\/learn\/lecture\/9407956#content<\/a><\/p>\n<ul>\n<li>and<\/li>\n<li>or<\/li>\n<li>not<\/li>\n<\/ul>\n<h3>and<\/h3>\n<p>Results of both sides of the &#8216;and&#8217; must be True. If one side fails, the result is False.<\/p>\n<pre>1 &lt; 2 &lt; 3<\/pre>\n<p>True<br \/>\n&#8220;is 1 less than 2 and is 2 less than 3&#8221;<br \/>\n* This format is not recommended because it is less readable.<\/p>\n<pre>1 &lt; 2 &gt; 3<\/pre>\n<p>False<br \/>\n&#8220;is 1 less than 2 and is 2 greater than 3&#8221;<\/p>\n<pre>1 &lt; 2 and 2 &lt; 3<\/pre>\n<p>True<\/p>\n<pre>(1 &lt; 2) and (2 &lt; 3)<\/pre>\n<p>True<\/p>\n<h3>or<\/h3>\n<p>One one side of the &#8216;or&#8217; comparison needs to be True. Only if both conditions are False, the result is False.<\/p>\n<pre>1 == 1 or 2 == 2<\/pre>\n<p>True<\/p>\n<pre>1 == 2 or 2 == 2<\/pre>\n<p>True<\/p>\n<pre>1 == 2 or 2 == 3<\/pre>\n<p>False<\/p>\n<h3>not<\/h3>\n<p>Returns the reverse of the result<\/p>\n<pre>not 1 == 1<\/pre>\n<p>False<\/p>\n<pre>not (1 == 1)<\/pre>\n<p>False<\/p>\n<pre>not True<\/pre>\n<p>False<\/p>\n<pre>not (1 == 2)<\/pre>\n<p>True<\/p>\n<pre>not (False)<\/pre>\n<p>True<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Section 4 Menu &lt; Section 3 Section 5 &gt; Comparison Operators in Python Chaining Comparison Operators in Python with Logical Operators Quiz Comparison Operators in Python https:\/\/www.udemy.com\/complete-python-bootcamp\/learn\/lecture\/9407954#content Operator Description Example&gt; == Equals 1 == 1 (True) 1 == 2 (False) != Not Equal 1 != 1 (False) 1 != 2 (True) &lt; Less Than 1 ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/wiki.thomasandsofia.com\/?p=1848\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[],"class_list":["post-1848","post","type-post","status-publish","format-standard","hentry","category-python-bootcamp-0-to-hero"],"_links":{"self":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/1848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1848"}],"version-history":[{"count":6,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/1848\/revisions"}],"predecessor-version":[{"id":1854,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=\/wp\/v2\/posts\/1848\/revisions\/1854"}],"wp:attachment":[{"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wiki.thomasandsofia.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}