{"id":157,"date":"2018-04-02T11:01:13","date_gmt":"2018-04-02T11:01:13","guid":{"rendered":"https:\/\/www.go4expert.com\/tutorials\/?p=157"},"modified":"2018-04-02T11:02:04","modified_gmt":"2018-04-02T11:02:04","slug":"python-operators","status":"publish","type":"post","link":"https:\/\/www.go4expert.com\/tutorials\/python-operators\/","title":{"rendered":"Python Operators and Their Precedence"},"content":{"rendered":"<p>Python has many operators which can perform specific operations. These operators can manipulate numbers or check conditions.<\/p>\n<p>And the best part, they are easy to understand and implement.<\/p>\n<h2><strong>Types of Operator: <\/strong><\/h2>\n<p>Python language supports the following types of operators.<\/p>\n<ol>\n<li>Arithmetic Operators<\/li>\n<li>Relational Operators<\/li>\n<li>Logical Operators<\/li>\n<li>Assignment Operators<\/li>\n<li>Membership Operators<\/li>\n<li>Bitwise Operators<\/li>\n<\/ol>\n<h2><strong>1. Arithmetic Operators: <\/strong><\/h2>\n<p>These operators are meant for number data types only. There perform the basic arithmetic operations:<\/p>\n<ul>\n<li>+ for addition<\/li>\n<li>\u2013 for subtraction<\/li>\n<li>* for multiplication<\/li>\n<li>\/ for division<\/li>\n<\/ul>\n<p>Python also has 3 arithmetic operators that are special. We will discuss them.<\/p>\n<h3><strong>a. % (Modulus operator)<\/strong> :<\/h3>\n<p>This operator gives the remainder of the division. And if there is no remainder it returns zero.<\/p>\n<p>For example: 22 % 7 = 1, 21 % 7 = 0<\/p>\n<h3><strong>b. ** (Exponent operator)<\/strong> :<\/h3>\n<p>This operator performs exponential (power) calculation on numbers. The first number is raised to the power of the second number.<\/p>\n<p>For example: 2**3 = 8<\/p>\n<h3><strong>c. \/\/ (Floor Division)<\/strong> :<\/h3>\n<p>This operator performs division but truncates off decimal part.<\/p>\n<p>For example: 44 \/\/ 7 = 6<\/p>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist88733002\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-arithmetic-operators-special-operators-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"Arithmetic Operators - special operators.py content, created by shabbirbhimani on 11:59AM on April 01, 2018.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"Arithmetic Operators - special operators.py\">\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC1\" class=\"blob-code blob-code-inner js-file-line\"># Let&#39;s declare variable variable1 with value 200, variable2 with value 30<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC2\" class=\"blob-code blob-code-inner js-file-line\">variable1 = 200<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">variable2 = 3<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;value of variable1 is&quot;, variable1)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC5\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;value of variable2 is&quot;, variable2)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC7\" class=\"blob-code blob-code-inner js-file-line\"># Performing modulus<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC8\" class=\"blob-code blob-code-inner js-file-line\">modulusOutput = variable1 % variable2<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC9\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;Value of modulus is&quot;, modulusOutput)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC10\" class=\"blob-code blob-code-inner js-file-line\"># output: Value of modulus is 2 <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC11\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC12\" class=\"blob-code blob-code-inner js-file-line\"># Performing Exponent function<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC13\" class=\"blob-code blob-code-inner js-file-line\">exponentOutput = variable1 ** variable2<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC14\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;Value of exponent is&quot;, exponentOutput)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC15\" class=\"blob-code blob-code-inner js-file-line\">#output: Value of exponent is 8000000<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC16\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC17\" class=\"blob-code blob-code-inner js-file-line\"># Performing floor division<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC18\" class=\"blob-code blob-code-inner js-file-line\">floorDivisionOutput = variable1 \/\/ variable2<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC19\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;Value of floor division is&quot;, floorDivisionOutput)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-arithmetic-operators-special-operators-py-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-arithmetic-operators-special-operators-py-LC20\" class=\"blob-code blob-code-inner js-file-line\"># output: Value of floor division is 66<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/097d4fd9c04ae86332f3898a91ccb1a7\/raw\/bd09f3aa1256544684b0bbf27dbfe594d87d0cee\/Arithmetic%20Operators%20-%20special%20operators.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/097d4fd9c04ae86332f3898a91ccb1a7#file-arithmetic-operators-special-operators-py\" class=\"Link--inTextBlock\">\n          Arithmetic Operators - special operators.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<h2>2. <strong>Relational Operators:<\/strong><\/h2>\n<p>These Operators used for comparing values. If the condition of comparison holds correct it gives <strong>True<\/strong> as output otherwise <strong>False<\/strong>.<\/p>\n<p>There are some basic relational operators:<\/p>\n<ul>\n<li>&lt; less than<\/li>\n<li>&gt; greater than<\/li>\n<li>&lt;= less than or equal to<\/li>\n<li>&gt;= greater than or equal to<\/li>\n<\/ul>\n<p>There are 2 special relational operators which are going to discuss.<\/p>\n<h3><strong>a. == (Equal comparison):<\/strong><\/h3>\n<p>Compares the 2 values and returns True if both values are equal.<\/p>\n<p>For example: 12 == 13 will give False<\/p>\n<h3><strong>b. != (Not Equal to) :<\/strong><\/h3>\n<p>Compares the 2 values and returns True if both values are not equal.<\/p>\n<p>For example: 12 != 13 will give True<\/p>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist88733011\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-relational-operators-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"Relational Operators.py content, created by shabbirbhimani on 12:00PM on April 01, 2018.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"Relational Operators.py\">\n        <tr>\n          <td id=\"file-relational-operators-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-relational-operators-py-LC1\" class=\"blob-code blob-code-inner js-file-line\"># lets declare a variable, variable1 with value 100<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-relational-operators-py-LC2\" class=\"blob-code blob-code-inner js-file-line\">variable1 = 100<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-relational-operators-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;Value of variable1 is&quot;, variable1)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-relational-operators-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-relational-operators-py-LC5\" class=\"blob-code blob-code-inner js-file-line\"># performing equality <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-relational-operators-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">EqualityOutput = variable1 == 100<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-relational-operators-py-LC7\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;is variable1 == 100&quot;, EqualityOutput)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-relational-operators-py-LC8\" class=\"blob-code blob-code-inner js-file-line\"># result: is variable1 == 100 True<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-relational-operators-py-LC9\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-relational-operators-py-LC10\" class=\"blob-code blob-code-inner js-file-line\"># performing not equal to<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-relational-operators-py-LC11\" class=\"blob-code blob-code-inner js-file-line\">output = variable1 !=100<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-relational-operators-py-LC12\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;is variable1 != 100&quot;, output)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-relational-operators-py-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-relational-operators-py-LC13\" class=\"blob-code blob-code-inner js-file-line\"># result: is variable1 != 100 False<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/c6a551b3d2b7fa1fd9551bcc41ac0cd0\/raw\/5d3a87363037e90b8f4ffacb1ce695279f6b7430\/Relational%20Operators.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/c6a551b3d2b7fa1fd9551bcc41ac0cd0#file-relational-operators-py\" class=\"Link--inTextBlock\">\n          Relational Operators.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<h2><strong>3. Logical Operators:<\/strong><\/h2>\n<p>In Programming we have to check for multiple conditions to reach a conclusion. And for that we use Logical Operators.<\/p>\n<p>A logical operator works on the conditions and gives output as True or False.<\/p>\n<p>Following are the logical operators:<\/p>\n<h4><strong>a. and : <\/strong><\/h4>\n<p>If the value of both the condition is True then, \u201cand\u201d operator will True as output. If the value of any of the condition is False then, \u201cand\u201d operator will give False as output.<\/p>\n<p>For Example: 12&gt; 13 and 12&lt;13 will give False<\/p>\n<h4><strong>b. or :<\/strong><\/h4>\n<p>If the value of any of the condition is True then, \u201cor\u201d operator will give True as output. If both the condition is False then, \u201cor\u201d operator will give False as output.<\/p>\n<p>For Example: 12&gt;13 or 12&lt;13 will give True<\/p>\n<h4><strong>c. not :<\/strong><\/h4>\n<p>\u201cnot\u201d operator reciprocates the output of condition. It converts True to False and vice versa.<\/p>\n<p>For example: not 12&gt; 13 will give True as output<\/p>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist88733015\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-logical-operators-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"Logical Operators.py content, created by shabbirbhimani on 12:00PM on April 01, 2018.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"Logical Operators.py\">\n        <tr>\n          <td id=\"file-logical-operators-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-logical-operators-py-LC1\" class=\"blob-code blob-code-inner js-file-line\"># Declare variable1 as 100 and variable as 200<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-logical-operators-py-LC2\" class=\"blob-code blob-code-inner js-file-line\">variable1 = 100<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-logical-operators-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">variable2 = 200<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-logical-operators-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;value of variable1&quot;, variable1)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-logical-operators-py-LC5\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;value of variable2&quot;, variable2)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-logical-operators-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-logical-operators-py-LC7\" class=\"blob-code blob-code-inner js-file-line\"># performing and operation<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-logical-operators-py-LC8\" class=\"blob-code blob-code-inner js-file-line\">andOutput = variable1 &gt; 90 and variable1 &lt; 105<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-logical-operators-py-LC9\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;is vairable1 greater than 90 and less than 105&quot;, andOutput)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-logical-operators-py-LC10\" class=\"blob-code blob-code-inner js-file-line\"># output: is vairable1 greater than 90 and less than 105 True<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-logical-operators-py-LC11\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-logical-operators-py-LC12\" class=\"blob-code blob-code-inner js-file-line\"># performing or operation<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-logical-operators-py-LC13\" class=\"blob-code blob-code-inner js-file-line\">orOperation = variable1 &gt; variable2 or variable2 &lt; 12<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-logical-operators-py-LC14\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;variable1 is greater than variable2 or variable2 less than 12&quot;, orOperation)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-logical-operators-py-LC15\" class=\"blob-code blob-code-inner js-file-line\"># output: variable1 is greater than variable2 or variable2 less than 12 False<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-logical-operators-py-LC16\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-logical-operators-py-LC17\" class=\"blob-code blob-code-inner js-file-line\"># performing not operation<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-logical-operators-py-LC18\" class=\"blob-code blob-code-inner js-file-line\">notOperation = not variable1 &gt; variable2<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-logical-operators-py-LC19\" class=\"blob-code blob-code-inner js-file-line\">print(&quot; not variable1 &gt; variable2&quot;, notOperation)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-logical-operators-py-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-logical-operators-py-LC20\" class=\"blob-code blob-code-inner js-file-line\"># output: not variable1 &gt; variable2 True<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/900bf65e2dd5816fcbad0ceab637cfac\/raw\/bebd3c45682accc90c3c1aba07118d3578dbd253\/Logical%20Operators.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/900bf65e2dd5816fcbad0ceab637cfac#file-logical-operators-py\" class=\"Link--inTextBlock\">\n          Logical Operators.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<h2><strong>4. Assignment Operators:<\/strong><\/h2>\n<p>These operators are used to assign the values into a variable. The assignment is done with the help of \u201c=\u201d (equal to ) operator.<\/p>\n<p>For example: variable1 = 12<\/p>\n<p>There is also a variation in the assignment called as short-hand operators. They are used to reduce the code and perform the operation while assigning.<\/p>\n<p>For example: variable2 = variable2 + 12 will be written as variable2 +=12<\/p>\n<p>Both the statements have the same meaning, but the second one is the short version of the first statement. Following are the short-hand operators used in python:<\/p>\n<ol>\n<li>+= adds the value to the variable before assigning<\/li>\n<li>-= subtracts the value from variable before assigning<\/li>\n<li>*= multiplies the value to the variable before assigning<\/li>\n<li>\/= divides the value to the variable before assigning<\/li>\n<li>%= perform modulus to the variable by value before assigning<\/li>\n<li>**= perform exponential to the variable by value before assigning<\/li>\n<li>\/\/= performs floor division to the variable by value before assigning<\/li>\n<\/ol>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist88733020\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-assignment-operators-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"Assignment Operators.py content, created by shabbirbhimani on 12:01PM on April 01, 2018.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"Assignment Operators.py\">\n        <tr>\n          <td id=\"file-assignment-operators-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-assignment-operators-py-LC1\" class=\"blob-code blob-code-inner js-file-line\"># DeoutputOperationlare the variable, variable1 as 21 and variable2 as 4<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-assignment-operators-py-LC2\" class=\"blob-code blob-code-inner js-file-line\"># we are going to perform series of operations and the result will be stored in outputOperation variable<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-assignment-operators-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-assignment-operators-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">variable1 = 21<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-assignment-operators-py-LC5\" class=\"blob-code blob-code-inner js-file-line\">variable2 = 4<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-assignment-operators-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;variable1 =&quot;, variable1)  # output: variable1 = 21<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-assignment-operators-py-LC7\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;variable2 =&quot;, variable2)  # output: variable2 = 4<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-assignment-operators-py-LC8\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-assignment-operators-py-LC9\" class=\"blob-code blob-code-inner js-file-line\"># performing addition<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-assignment-operators-py-LC10\" class=\"blob-code blob-code-inner js-file-line\">outputOperation = variable1 + variable2<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-assignment-operators-py-LC11\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;outputOperation = &quot;, outputOperation )  # output: outputOperation = 25<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-assignment-operators-py-LC12\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-assignment-operators-py-LC13\" class=\"blob-code blob-code-inner js-file-line\"># performing shorthand addition<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-assignment-operators-py-LC14\" class=\"blob-code blob-code-inner js-file-line\">outputOperation += variable1<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-assignment-operators-py-LC15\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;outputOperation = &quot;, outputOperation ) # output: outputOperation = 46<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-assignment-operators-py-LC16\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-assignment-operators-py-LC17\" class=\"blob-code blob-code-inner js-file-line\"># performing shorthand multiplication<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-assignment-operators-py-LC18\" class=\"blob-code blob-code-inner js-file-line\">outputOperation *= variable1<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-assignment-operators-py-LC19\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;outputOperation = &quot;, outputOperation ) # output: outputOperation = 966<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-assignment-operators-py-LC20\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-assignment-operators-py-LC21\" class=\"blob-code blob-code-inner js-file-line\"># performing shorthand divison<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-assignment-operators-py-LC22\" class=\"blob-code blob-code-inner js-file-line\">outputOperation \/= variable1<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-assignment-operators-py-LC23\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;outputOperation = &quot;, outputOperation ) # output: outputOperation = 46.0<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-assignment-operators-py-LC24\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-assignment-operators-py-LC25\" class=\"blob-code blob-code-inner js-file-line\"># performing shorthand modulus<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-assignment-operators-py-LC26\" class=\"blob-code blob-code-inner js-file-line\">outputOperation %= variable1<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-assignment-operators-py-LC27\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;outputOperation = &quot;, outputOperation ) # output: outputOperation = 4.0<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-assignment-operators-py-LC28\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-assignment-operators-py-LC29\" class=\"blob-code blob-code-inner js-file-line\"># performing shorthand exponent<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-assignment-operators-py-LC30\" class=\"blob-code blob-code-inner js-file-line\">outputOperation **= variable2<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-assignment-operators-py-LC31\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;outputOperation = &quot;, outputOperation ) # output: outputOperation = 256.0<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-assignment-operators-py-LC32\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L33\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"33\"><\/td>\n          <td id=\"file-assignment-operators-py-LC33\" class=\"blob-code blob-code-inner js-file-line\"># performing shorthand floor division<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L34\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"34\"><\/td>\n          <td id=\"file-assignment-operators-py-LC34\" class=\"blob-code blob-code-inner js-file-line\">outputOperation \/\/= variable1<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-assignment-operators-py-L35\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"35\"><\/td>\n          <td id=\"file-assignment-operators-py-LC35\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;outputOperation = &quot;, outputOperation ) # output: outputOperation = 12.0<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/70c088dc34ff8e00e5a53a152df9254e\/raw\/8745c0e2f7bcf43bc16159468da19b72aa050fdc\/Assignment%20Operators.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/70c088dc34ff8e00e5a53a152df9254e#file-assignment-operators-py\" class=\"Link--inTextBlock\">\n          Assignment Operators.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<h2><strong>5. Membership Operators:<\/strong><\/h2>\n<p>These operators are used to find out whether a value is part of a variable or not. These operators are not for numbers. These operators can be used for all other data types. These are<\/p>\n<h4>a. in :<\/h4>\n<p>This operator returns True if the value is part of the variable.<\/p>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist88733025\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-membership-operators-in-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"Membership Operators - in.py content, created by shabbirbhimani on 12:02PM on April 01, 2018.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"Membership Operators - in.py\">\n        <tr>\n          <td id=\"file-membership-operators-in-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-membership-operators-in-py-LC1\" class=\"blob-code blob-code-inner js-file-line\"># Declare a string1 variable<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-in-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-membership-operators-in-py-LC2\" class=\"blob-code blob-code-inner js-file-line\"># Find &quot;H1&quot; in string 1<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-in-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-membership-operators-in-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">string1 = &quot;Hello World&quot;<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-in-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-membership-operators-in-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;value of string1 is&quot;, string1)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-in-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-membership-operators-in-py-LC5\" class=\"blob-code blob-code-inner js-file-line\"># output: value of string1 is Hello World<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-in-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-membership-operators-in-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-in-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-membership-operators-in-py-LC7\" class=\"blob-code blob-code-inner js-file-line\">inOutput = &quot;H&quot; in string1<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-in-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-membership-operators-in-py-LC8\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;is &#39;H&#39; in string1&quot;, inOutput)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-in-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-membership-operators-in-py-LC9\" class=\"blob-code blob-code-inner js-file-line\"># output: is &#39;H&#39; in string1 True<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/34bf0e40f63e0d4ac91d0c0713648bc0\/raw\/d0a0dbd74afbe7d9d118fe1313f8640d6bb12747\/Membership%20Operators%20-%20in.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/34bf0e40f63e0d4ac91d0c0713648bc0#file-membership-operators-in-py\" class=\"Link--inTextBlock\">\n          Membership Operators - in.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<h4>b. not in :<\/h4>\n<p>This operator returns False if the value is part of the variable.<\/p>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist88733040\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-membership-operators-not-in-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"Membership Operators - not in.py content, created by shabbirbhimani on 12:02PM on April 01, 2018.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"Membership Operators - not in.py\">\n        <tr>\n          <td id=\"file-membership-operators-not-in-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-membership-operators-not-in-py-LC1\" class=\"blob-code blob-code-inner js-file-line\"># Declare a list list1 with value [12,23,34]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-not-in-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-membership-operators-not-in-py-LC2\" class=\"blob-code blob-code-inner js-file-line\">list1 = [12,23,34]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-not-in-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-membership-operators-not-in-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;value os list1 is&quot;, list1)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-not-in-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-membership-operators-not-in-py-LC4\" class=\"blob-code blob-code-inner js-file-line\"># output: value os list1 is [12, 23, 34]<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-not-in-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-membership-operators-not-in-py-LC5\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-not-in-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-membership-operators-not-in-py-LC6\" class=\"blob-code blob-code-inner js-file-line\"># using not in operator for 25<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-not-in-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-membership-operators-not-in-py-LC7\" class=\"blob-code blob-code-inner js-file-line\">notInOperator = 25 not in list1<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-not-in-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-membership-operators-not-in-py-LC8\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;is 25 not in list1&quot;, notInOperator)<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-membership-operators-not-in-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-membership-operators-not-in-py-LC9\" class=\"blob-code blob-code-inner js-file-line\"># output: is 25 not in list1 True<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/8f491c410197f30a64ff13a804aa76fd\/raw\/a648ea2ed353642db01dca9e0701f60a2248898d\/Membership%20Operators%20-%20not%20in.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/8f491c410197f30a64ff13a804aa76fd#file-membership-operators-not-in-py\" class=\"Link--inTextBlock\">\n          Membership Operators - not in.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<p><strong>Note:<\/strong> in and not in operators will work for Dictionary Keys and not values.<\/p>\n<h2><strong>6. Bitwise Operators:<\/strong><\/h2>\n<p>These operators are used on numbers only and they are used to perform bit-level manipulation.<\/p>\n<p>These operators first convert a number into the binary form and then perform specific operations. The result is then converted back into decimal number format and given as output.<\/p>\n<p>We can check the binary value of a number by using bin function. Following are the operators:<\/p>\n<ol>\n<li><strong>&amp; (Binary AND)<\/strong> \u2013 performs \u201cand\u201d operations on bits of both variables<\/li>\n<li><strong>| (Binary OR<\/strong>) - performs \u201cor\u201d operations on bits of both variables<\/li>\n<li><strong>^ (Binary XOR)<\/strong> \u2013 gives output as 1 bit if one bit<\/li>\n<li><strong>~ (Binary Complement)<\/strong> \u2013 used for a single variable, this operator complements the binary bits of a variable<\/li>\n<li><strong>&lt;&lt; (Binary Left Shift)<\/strong> \u2013 variable binary value is moved to shifted to the left side and 0 is added in the end<\/li>\n<li><strong>&gt;&gt; (Binary Right Shift)<\/strong> \u2013 variable binary value is moved towards the right side and the rightmost bit is discarded<\/li>\n<\/ol>\n<style>.gist table { margin-bottom: 0; }<\/style><div style=\"tab-size: 8\" id=\"gist88733047\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-bitwise-operators-py\" class=\"file my-2\">\n    \n    <div itemprop=\"text\"\n      class=\"Box-body p-0 blob-wrapper data type-python  \"\n      style=\"overflow: auto\" tabindex=\"0\" role=\"region\"\n      aria-label=\"Bitwise Operators.py content, created by shabbirbhimani on 12:03PM on April 01, 2018.\"\n    >\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"{{ revealButtonHref }}\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"Bitwise Operators.py\">\n        <tr>\n          <td id=\"file-bitwise-operators-py-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC1\" class=\"blob-code blob-code-inner js-file-line\"># declare 2 variables, variable1 with value 78, and variable2 with value 341<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC2\" class=\"blob-code blob-code-inner js-file-line\"># we are going to perform series of operations and the result will be stored in output variable<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC3\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC4\" class=\"blob-code blob-code-inner js-file-line\">variable1 = 78 <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC5\" class=\"blob-code blob-code-inner js-file-line\">variable2 = 341<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC6\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;variable1 =&quot;,variable1,&quot; - binary value =&quot;,bin(variable1))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC7\" class=\"blob-code blob-code-inner js-file-line\">print(&quot;variable2 =&quot;,variable2,&quot; - binary value =&quot;,bin(variable2))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC8\" class=\"blob-code blob-code-inner js-file-line\"># output: variable1 = 78  - binary value = 0b1001110<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC9\" class=\"blob-code blob-code-inner js-file-line\"># output: variable2 = 341  - binary value = 0b101010101<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC10\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC11\" class=\"blob-code blob-code-inner js-file-line\"># performing binary &amp; operation<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC12\" class=\"blob-code blob-code-inner js-file-line\">output = variable1 &amp; variable2 <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC13\" class=\"blob-code blob-code-inner js-file-line\">print (&quot;output of binary &amp; operation is &quot;, output,&#39; -&#39;,bin(output))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC14\" class=\"blob-code blob-code-inner js-file-line\"># output : output of binary &amp; operation is  68  - 0b1000100<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC15\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC16\" class=\"blob-code blob-code-inner js-file-line\"># performing binary or operation<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC17\" class=\"blob-code blob-code-inner js-file-line\">output = variable1 | variable2 <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC18\" class=\"blob-code blob-code-inner js-file-line\">print (&quot;output of binary or operation is &quot;, output,&#39; -&#39;,bin(output))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC19\" class=\"blob-code blob-code-inner js-file-line\"># output : output of binary or operation is  351  - 0b101011111<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC20\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC21\" class=\"blob-code blob-code-inner js-file-line\"># performing binary xor operation<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC22\" class=\"blob-code blob-code-inner js-file-line\">output = variable1 ^ variable2 <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC23\" class=\"blob-code blob-code-inner js-file-line\">print (&quot;output of binary xor operation is &quot;, output,&#39; -&#39;,bin(output))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC24\" class=\"blob-code blob-code-inner js-file-line\"># output: output of binary xor operation is  283  - 0b100011011<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC25\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC26\" class=\"blob-code blob-code-inner js-file-line\"># performing binary complement operation<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC27\" class=\"blob-code blob-code-inner js-file-line\">output = ~variable1 <\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC28\" class=\"blob-code blob-code-inner js-file-line\">print (&quot;output of binary complement is &quot;, output,&#39; -&#39;,bin(output))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC29\" class=\"blob-code blob-code-inner js-file-line\"># output: output of binary complement is  -79  - -0b1001111<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC30\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC31\" class=\"blob-code blob-code-inner js-file-line\"># performing binary left shift operation<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC32\" class=\"blob-code blob-code-inner js-file-line\">output = variable2 &lt;&lt; 2<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L33\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"33\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC33\" class=\"blob-code blob-code-inner js-file-line\">print (&quot;output of binary left shift is &quot;, output,&#39; -&#39;,bin(output))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L34\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"34\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC34\" class=\"blob-code blob-code-inner js-file-line\"># output: output of binary left shift is  1364  - 0b10101010100<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L35\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"35\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC35\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L36\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"36\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC36\" class=\"blob-code blob-code-inner js-file-line\"># performing binary right shift operation<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L37\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"37\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC37\" class=\"blob-code blob-code-inner js-file-line\">output = variable2 &gt;&gt; 2<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L38\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"38\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC38\" class=\"blob-code blob-code-inner js-file-line\">print (&quot;output of binary right shift is &quot;, output,&#39; -&#39;,bin(output))<\/td>\n        <\/tr>\n        <tr>\n          <td id=\"file-bitwise-operators-py-L39\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"39\"><\/td>\n          <td id=\"file-bitwise-operators-py-LC39\" class=\"blob-code blob-code-inner js-file-line\"># output: output of binary right shift is  85  - 0b1010101<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/0a0f1960635680e762d7bed74612d5a8\/raw\/e634b4dfc7646d06b859839fe52447528da23190\/Bitwise%20Operators.py\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/shabbirbhimani\/0a0f1960635680e762d7bed74612d5a8#file-bitwise-operators-py\" class=\"Link--inTextBlock\">\n          Bitwise Operators.py\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<h2><strong>Operator Precedence:<\/strong><\/h2>\n<p>What will happen if in an expression there is more than one operator? In that case, operators will follow the following precedence.<\/p>\n<ol>\n<li><strong>**<\/strong> Exponentiation (raise to the power)<\/li>\n<li><strong>~<\/strong> Binary Complement<\/li>\n<li><strong>* \/ % \/\/<\/strong> Multiply, divide, modulo and floor division<\/li>\n<li><strong>+ -<\/strong> Addition and subtraction<\/li>\n<li><strong>&gt;&gt; &lt;&lt;<\/strong> Right and left bitwise shift<\/li>\n<li><strong>&amp; <\/strong> Bitwise 'AND'<\/li>\n<li><strong>^|<\/strong> Bitwise exclusive `OR' and regular `OR'<\/li>\n<li><strong>&lt;= &lt; &gt; &gt;=<\/strong> Comparison operators<\/li>\n<li><strong>&lt;&gt; == !=<\/strong> Equality operators<\/li>\n<li><strong>= %= \/= \/\/= -= += *=<\/strong> Assignment operators<\/li>\n<li><strong>in not in<\/strong> Membership operators<\/li>\n<li><strong>not or and <\/strong>Logical operators<\/li>\n<\/ol>\n<h2><strong>Key Takeaways:<\/strong><\/h2>\n<ol>\n<li>Arithmetic operators are used only by the number data types.<\/li>\n<li>Relational operators compare the values and give the output as True or False.<\/li>\n<li>Logical Operators compares the conditions and give output as True or False.<\/li>\n<li>Assignment operators are used to assigning values and short-hand operators are used to manipulate value before assigning.<\/li>\n<li>A membership variable tells whether a value is part of a variable or not.<\/li>\n<li>Bitwise operator operates on the binary bits of number data type only.<\/li>\n<\/ol>\n<h2><strong>Programming exercises:<\/strong><\/h2>\n<ol>\n<li>Perform the following steps:\n<ul>\n<li>Declare a variable variable1 assign value 200 to it<\/li>\n<li>Perform short-hand subtraction of the value 20 on variable1<\/li>\n<li>Perform short-hand modulus with the value 27 on variable1<\/li>\n<li>Perform left shit bitwise operator with 2 as a value on variable1<\/li>\n<li>Compare equality operator on variable1 with 72 and assign the value in a variable output<\/li>\n<li>Print value of output, it should be True.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<ol start=\"2\">\n<li>Perform the following steps:\n<ul>\n<li>Declare a variable, variable2 with the value 23<\/li>\n<li>Perform short-hand multiplication with the value 456 on variable2<\/li>\n<li>Perform short-hand floor division with the value 34 on variable2<\/li>\n<li>Perform right shit bitwise operator with 2 as a value on variable2<\/li>\n<li>Declare a list, list1 with the value [7, 77, 777]<\/li>\n<li>Perform variable2 \"not in\" operator on list1 and assign the value in a variable output.<\/li>\n<li>Print the value of output, it should be False.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>You can download the solution files <a href=\"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/04\/Python-operators.zip\">Python operators<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python operators are used to perform manipulation in data as well as for evaluating conditions. In this tutorial, we are going to explore Arithmetic, Relational, Logical, Assignment, Membership, and Bitwise operators. We are going to explain function and specialty of each operator using coding examples.<\/p>\n","protected":false},"author":1,"featured_media":35,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[5],"tags":[],"class_list":{"0":"post-157","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python","8":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Operators and Their Precedence - Go4Expert Tutorials<\/title>\n<meta name=\"description\" content=\"Python operators are used to perform manipulation in data as well as for evaluating conditions. In this tutorial, we are going to explore Arithmetic, Relational, Logical, Assignment, Membership, and Bitwise operators. We are going to explain function and specialty of each operator using coding examples.\" \/>\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.go4expert.com\/tutorials\/python-operators\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Operators and Their Precedence - Go4Expert Tutorials\" \/>\n<meta property=\"og:description\" content=\"Python operators are used to perform manipulation in data as well as for evaluating conditions. In this tutorial, we are going to explore Arithmetic, Relational, Logical, Assignment, Membership, and Bitwise operators. We are going to explain function and specialty of each operator using coding examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.go4expert.com\/tutorials\/python-operators\/\" \/>\n<meta property=\"og:site_name\" content=\"Go4Expert Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-02T11:01:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-04-02T11:02:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"shabbir\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"shabbir\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/python-operators\/\",\"url\":\"https:\/\/www.go4expert.com\/tutorials\/python-operators\/\",\"name\":\"Python Operators and Their Precedence - Go4Expert Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/#website\"},\"datePublished\":\"2018-04-02T11:01:13+00:00\",\"dateModified\":\"2018-04-02T11:02:04+00:00\",\"author\":{\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/187ce4675295e6b09b98a9374ce2fec6\"},\"description\":\"Python operators are used to perform manipulation in data as well as for evaluating conditions. In this tutorial, we are going to explore Arithmetic, Relational, Logical, Assignment, Membership, and Bitwise operators. We are going to explain function and specialty of each operator using coding examples.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/python-operators\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.go4expert.com\/tutorials\/python-operators\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/python-operators\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.go4expert.com\/tutorials\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Operators and Their Precedence\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/#website\",\"url\":\"https:\/\/www.go4expert.com\/tutorials\/\",\"name\":\"Go4Expert Tutorials\",\"description\":\"Programming And Web Development Tutorials\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.go4expert.com\/tutorials\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/187ce4675295e6b09b98a9374ce2fec6\",\"name\":\"shabbir\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/303ce933c6bfabf6ac58bc870c696a1d5ef98012ecb820a4a7921853b813406f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/303ce933c6bfabf6ac58bc870c696a1d5ef98012ecb820a4a7921853b813406f?s=96&d=mm&r=g\",\"caption\":\"shabbir\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Operators and Their Precedence - Go4Expert Tutorials","description":"Python operators are used to perform manipulation in data as well as for evaluating conditions. In this tutorial, we are going to explore Arithmetic, Relational, Logical, Assignment, Membership, and Bitwise operators. We are going to explain function and specialty of each operator using coding examples.","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.go4expert.com\/tutorials\/python-operators\/","og_locale":"en_US","og_type":"article","og_title":"Python Operators and Their Precedence - Go4Expert Tutorials","og_description":"Python operators are used to perform manipulation in data as well as for evaluating conditions. In this tutorial, we are going to explore Arithmetic, Relational, Logical, Assignment, Membership, and Bitwise operators. We are going to explain function and specialty of each operator using coding examples.","og_url":"https:\/\/www.go4expert.com\/tutorials\/python-operators\/","og_site_name":"Go4Expert Tutorials","article_published_time":"2018-04-02T11:01:13+00:00","article_modified_time":"2018-04-02T11:02:04+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/python.jpg","type":"image\/jpeg"}],"author":"shabbir","twitter_card":"summary_large_image","twitter_misc":{"Written by":"shabbir","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.go4expert.com\/tutorials\/python-operators\/","url":"https:\/\/www.go4expert.com\/tutorials\/python-operators\/","name":"Python Operators and Their Precedence - Go4Expert Tutorials","isPartOf":{"@id":"https:\/\/www.go4expert.com\/tutorials\/#website"},"datePublished":"2018-04-02T11:01:13+00:00","dateModified":"2018-04-02T11:02:04+00:00","author":{"@id":"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/187ce4675295e6b09b98a9374ce2fec6"},"description":"Python operators are used to perform manipulation in data as well as for evaluating conditions. In this tutorial, we are going to explore Arithmetic, Relational, Logical, Assignment, Membership, and Bitwise operators. We are going to explain function and specialty of each operator using coding examples.","breadcrumb":{"@id":"https:\/\/www.go4expert.com\/tutorials\/python-operators\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.go4expert.com\/tutorials\/python-operators\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.go4expert.com\/tutorials\/python-operators\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.go4expert.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Python Operators and Their Precedence"}]},{"@type":"WebSite","@id":"https:\/\/www.go4expert.com\/tutorials\/#website","url":"https:\/\/www.go4expert.com\/tutorials\/","name":"Go4Expert Tutorials","description":"Programming And Web Development Tutorials","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.go4expert.com\/tutorials\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/187ce4675295e6b09b98a9374ce2fec6","name":"shabbir","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.go4expert.com\/tutorials\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/303ce933c6bfabf6ac58bc870c696a1d5ef98012ecb820a4a7921853b813406f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/303ce933c6bfabf6ac58bc870c696a1d5ef98012ecb820a4a7921853b813406f?s=96&d=mm&r=g","caption":"shabbir"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.go4expert.com\/tutorials\/wp-content\/uploads\/2018\/03\/python.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9JSSi-2x","_links":{"self":[{"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/posts\/157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/comments?post=157"}],"version-history":[{"count":10,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/posts\/157\/revisions"}],"predecessor-version":[{"id":168,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/posts\/157\/revisions\/168"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/media\/35"}],"wp:attachment":[{"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/media?parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/categories?post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.go4expert.com\/tutorials\/wp-json\/wp\/v2\/tags?post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}