{"id":2018,"date":"2020-12-29T10:28:52","date_gmt":"2020-12-29T10:28:52","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=2018"},"modified":"2025-03-27T15:47:36","modified_gmt":"2025-03-27T15:47:36","slug":"python-and","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/advanced-python\/python-and\/","title":{"rendered":"Python and Operator"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn about the Python <code>and<\/code> logical operator and how to use it to control the flow of code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-the-python-and-operator'>Introduction to the Python and operator <a href=\"#introduction-to-the-python-and-operator\" class=\"anchor\" id=\"introduction-to-the-python-and-operator\" title=\"Anchor for Introduction to the Python &lt;code&gt;and&lt;\/code&gt; operator\">#<\/a><\/h2>\n\n\n\n<p>The Python <code>and<\/code> operator is a <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-logical-operators\/\">logical operator<\/a>. Typically, you use the <code>and<\/code> operator to operate on Boolean values and return a <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-boolean\/\">Boolean value<\/a>.<\/p>\n\n\n\n<p>The <code>and<\/code> operator returns <code>True<\/code> if both operands evaluate to <code>True<\/code>. Otherwise, it returns <code>False<\/code>.<\/p>\n\n\n\n<p>The following truth table shows the result of the <code>and<\/code> operator:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>X<\/th><th>Y<\/th><th>X and Y<\/th><\/tr><\/thead><tbody><tr><td>True<\/td><td>True<\/td><td>True<\/td><\/tr><tr><td>True<\/td><td>False<\/td><td>False<\/td><\/tr><tr><td>False<\/td><td>False<\/td><td>False<\/td><\/tr><tr><td>False<\/td><td>True<\/td><td>False<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>This table illustrates two important points:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If the first operand (<code>X<\/code>) is <code>True<\/code>, the result of the <code>and<\/code> operator depends on the result of the second operand (<code>Y<\/code>).<\/li>\n\n\n\n<li>If the first operand (<code>X<\/code>) is <code>False<\/code>, the result of the <code>and<\/code> operator is always <code>False<\/code> regardless of the value of the second operand (<code>Y<\/code>).<\/li>\n<\/ul>\n\n\n\n<p>The following shows an example of using the <code>and<\/code> operator:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">timeout = <span class=\"hljs-literal\">False<\/span>\npending_job = <span class=\"hljs-literal\">True<\/span>\nexecute_next =\u00a0timeout <span class=\"hljs-keyword\">and<\/span> pending_job\n\nprint(execute_next)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-literal\">False<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, the <code>timeout<\/code> is <code>False<\/code> and <code>pending_job<\/code> is <code>True<\/code>. Therefore, the result of the expression <code>timeout&nbsp;and&nbsp;pending_job<\/code> is <code>False<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='python-and-operator-is-short-circuiting'>Python and operator is short-circuiting <a href=\"#python-and-operator-is-short-circuiting\" class=\"anchor\" id=\"python-and-operator-is-short-circuiting\" title=\"Anchor for Python and operator is short-circuiting\">#<\/a><\/h2>\n\n\n\n<p>The key feature of the <code>and<\/code> operator is that it short-circuits. It means that if the first operand is <code>False<\/code>, the <code>and<\/code> operator won&#8217;t evaluate the second operand. The reason is that it already has a conclusion about the outcome, which is <code>False<\/code>.<\/p>\n\n\n\n<p>The following example results in a <code>ZeroDivisionError<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">a\u00a0=\u00a0<span class=\"hljs-number\">10<\/span>\nb\u00a0=\u00a0<span class=\"hljs-number\">0<\/span>\nc\u00a0=\u00a0a\u00a0\/\u00a0b\nprint(c)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, since <code>b<\/code> is zero, the <code>a \/ b<\/code> definitely causes the division by zero exception.<\/p>\n\n\n\n<p>However, the following example won&#8217;t cause a <code>ZeroDivisionError<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">a\u00a0=\u00a0<span class=\"hljs-number\">10<\/span>\nb\u00a0=\u00a0<span class=\"hljs-number\">0<\/span>\nc\u00a0=\u00a0b\u00a0<span class=\"hljs-keyword\">and<\/span>\u00a0a\/b\nprint(c)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">0<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, we used the <code>and<\/code> operator in the expression:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">c\u00a0=\u00a0b\u00a0<span class=\"hljs-keyword\">and<\/span>\u00a0a\/b<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Since <code>b<\/code> is zero, which is <code>False<\/code>, the <code>and<\/code> operator can conclude the result of the whole expression, which is <code>False<\/code> regardless of the result of the second part <code>a \/ b<\/code>. Therefore, the <code>and<\/code> operator doesn&#8217;t need to evaluate the expression <code>a \/ b<\/code>. In fact, it doesn&#8217;t do so.<\/p>\n\n\n\n<p>The following example changes the value of <code>b<\/code> to five:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">a\u00a0=\u00a0<span class=\"hljs-number\">10<\/span>\nb\u00a0=\u00a0<span class=\"hljs-number\">5<\/span>\nc\u00a0=\u00a0b\u00a0<span class=\"hljs-keyword\">and<\/span>\u00a0a\/b\nprint(c)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">2.0<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, <code>b<\/code> is <code>5<\/code> which is <code>True<\/code>. Since the first operand is <code>True<\/code>, the value of the whole expression depends on the value of the second operand, which is <code>a \/ b<\/code>.<\/p>\n\n\n\n<p>These examples show that the <code>and<\/code> operator can operate with non-Boolean values and returns a non-value boolean value.<\/p>\n\n\n\n<p>In general, you can use the <code>and<\/code> operator for the objects:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">bool(object1) <span class=\"hljs-keyword\">and<\/span> bool(object2)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In fact, you don&#8217;t need to use the <code><a href=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-bool\/\">bool()<\/a><\/code> constructor:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">object1 <span class=\"hljs-keyword\">and<\/span> object2<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this case, the <code>and<\/code> opeartor returns the <code>object1<\/code> if it&#8217;s falsy. Otherwise, it returns the <code>object2<\/code>.<\/p>\n\n\n\n<p>In other words, the <code>and<\/code> operator returns the <code>object1<\/code> if the <code>object1<\/code> is falsy.  Otherwise, it evaluates the <code>object2<\/code> and returns it.<\/p>\n\n\n\n<p>The expression<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">c\u00a0=\u00a0b\u00a0<span class=\"hljs-keyword\">and<\/span>\u00a0a\/b<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>is equivalent to the following:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">if<\/span>\u00a0b:\n\u00a0\u00a0\u00a0\u00a0c\u00a0=\u00a0a\u00a0\/\u00a0b\n<span class=\"hljs-keyword\">else<\/span>:\n\u00a0\u00a0\u00a0\u00a0c\u00a0=\u00a0b<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>By using the <code>and<\/code> operator, you can control the flow of the program.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='python-and-operator-example'>Python and operator example <a href=\"#python-and-operator-example\" class=\"anchor\" id=\"python-and-operator-example\" title=\"Anchor for Python &lt;code&gt;and&lt;\/code&gt; operator example\">#<\/a><\/h2>\n\n\n\n<p>The following defines the <code>avg()<\/code> function that calculates the average of numbers:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">avg<\/span><span class=\"hljs-params\">(*numbers)<\/span>:<\/span>\n    total = sum(numbers)\n    n = len(numbers)\n    <span class=\"hljs-keyword\">if<\/span> n &gt; <span class=\"hljs-number\">0<\/span>:\n        <span class=\"hljs-keyword\">return<\/span> total \/ n\n    <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-number\">0<\/span>\n\n\n<span class=\"hljs-keyword\">if<\/span> __name__ == <span class=\"hljs-string\">\"__main__\"<\/span>:\n    print(avg(<span class=\"hljs-number\">1<\/span>, <span class=\"hljs-number\">2<\/span>, <span class=\"hljs-number\">3<\/span>))<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=ZGVmIGF2ZygqbnVtYmVycyk6CiAgICB0b3RhbCA9IHN1bShudW1iZXJzKQogICAgbiA9IGxlbihudW1iZXJzKQogICAgaWYgbiA%2BIDA6CiAgICAgICAgcmV0dXJuIHRvdGFsIC8gbgogICAgcmV0dXJuIDAKCgppZiBfX25hbWVfXyA9PSAiX19tYWluX18iOgogICAgcHJpbnQoYXZnKDEsIDIsIDMpKQ%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">2.0<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>How it works.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, calculate the sum of the numbers using the <code>sum()<\/code> function.<\/li>\n\n\n\n<li>Second, get the number numbers using the <code>len()<\/code> function.<\/li>\n\n\n\n<li>Third, return the average if the number of numbers is greater than zero, otherwise, return zero.<\/li>\n<\/ul>\n\n\n\n<p>The main block calculates the average of three numbers 1, 2, and 3, which returns 2.0 as expected.<\/p>\n\n\n\n<p>The following code uses an <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-if\/\"><code>if<\/code> statement <\/a>and returns the average if the number of numbers is greater than zero. Otherwise, it returns zero:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">if<\/span> n &gt; <span class=\"hljs-number\">0<\/span>:\n    <span class=\"hljs-keyword\">return<\/span> total \/ n\n<span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-number\">0<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In fact, you can use the and operator to make this code more concise like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-16\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">return<\/span> n <span class=\"hljs-keyword\">and<\/span> total \/ n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-16\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this case, if <code>n<\/code> is zero the and operator doesn&#8217;t need to evaluate the expression <code>total \/ n<\/code> and it returns zero. Otherwise, it evaluates the <code>total \/ n<\/code> and returns it.<\/p>\n\n\n\n<p>Here is the new version of the <code>avg()<\/code> function that uses the <code>and<\/code> operator:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-17\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">avg<\/span><span class=\"hljs-params\">(*numbers)<\/span>:<\/span>\n    total = sum(numbers)\n    n = len(numbers)\n\n    <span class=\"hljs-keyword\">return<\/span> n <span class=\"hljs-keyword\">and<\/span> total \/ n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-17\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>X and Y<\/code> returns <code>True<\/code> if both <code>X<\/code> and <code>Y<\/code> evaluate to <code>True<\/code>. Otherwise, it returns <code>False<\/code>.<\/li>\n\n\n\n<li>The <code>X and Y<\/code> actually returns <code>X<\/code> if <code>X<\/code> is falsy. Otherwise, it evaluates <code>Y<\/code> and returns the result of the evaluation.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"2018\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-and\/\"\n\t\t\t\tdata-post-title=\"Python and Operator\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"2018\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-and\/\"\n\t\t\t\tdata-post-title=\"Python and Operator\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn about the Python and logical operator.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":757,"menu_order":28,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2018","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/comments?post=2018"}],"version-history":[{"count":2,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2018\/revisions"}],"predecessor-version":[{"id":7142,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2018\/revisions\/7142"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/757"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=2018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}