{"id":95,"date":"2019-01-11T01:17:30","date_gmt":"2019-01-11T01:17:30","guid":{"rendered":"https:\/\/kindsonthegenius.com\/python\/?p=95"},"modified":"2019-03-31T21:09:05","modified_gmt":"2019-03-31T21:09:05","slug":"05-python-operators","status":"publish","type":"post","link":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/","title":{"rendered":"Python &#8211; Operators"},"content":{"rendered":"\r\n<p>Just as you know, operators are symbols used to perform various operations and get results. In programming terms we say operator work on operands. We are going to consider a number of operators used in Python.<\/p>\r\n\r\n\r\n<hr \/>\r\n<p>&nbsp;<\/p>\r\n\r\n<h4 class=\"wp-block-heading\">Types of Operators in Python<\/h4>\r\n\r\n\r\n\r\n<p>There are 7 types of operators supported by the Python programming language as listed below:<\/p>\r\n\r\n\r\n\r\n<div style=\"margin-left: 30px;\">\r\n<ul>\r\n<li>Arithmetic Operator<\/li>\r\n<li>Comparison Operator<\/li>\r\n<li>Assignment Operators<\/li>\r\n<li>Logical Operators<\/li>\r\n<li>Bitwise Operators<\/li>\r\n<li>Membership Operators<\/li>\r\n<li>Identity Operators<\/li>\r\n<\/ul>\r\n<\/div>\r\n\r\n\r\n\r\n<p>So we begin with the first one &#8211; Arithmetic Operators<\/p>\r\n\r\n\r\n<hr \/>\r\n<p>&nbsp;<\/p>\r\n\r\n<h4 class=\"wp-block-heading\">Python Arithmetic Operator<\/h4>\r\n\r\n\r\n\r\n<p>Arithmetic operators just as the name indicates are operators used to perform arithmetic operations in Python. The table below outlines the arithmetic operators and their description. It also includes an example when x = 10 and y = 20<\/p>\r\n\r\n\r\n\r\n<table class=\"wp-block-table is-style-stripes\" border=\"1\">\r\n<tbody>\r\n<tr>\r\n<th>Operator<\/th>\r\n<th>Description<\/th>\r\n<th>Example<\/th>\r\n<\/tr>\r\n<tr>\r\n<td>+ Addition<\/td>\r\n<td>Adds values on either side of the operator.<\/td>\r\n<td>a + b = 30<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>&#8211; Subtraction<\/td>\r\n<td>Subtracts right hand operand from left hand operand.<\/td>\r\n<td>a \u2013 b = -10<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>* Multiplication<\/td>\r\n<td>It multiplies values on either side of the operator<\/td>\r\n<td>a * b = 200<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\/ Division<\/td>\r\n<td>It divides left hand operand by right hand operand<\/td>\r\n<td>b \/ a = 2<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>% Modulus<\/td>\r\n<td>It divides left hand operand by right hand operand and returns remainder<\/td>\r\n<td>x % y = 0<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>** Exponent<\/td>\r\n<td>It performs exponential (power) calculation on operators<\/td>\r\n<td>x**y =10 to the power 20<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\/\/<\/td>\r\n<td>Known as Floor Division &#8211; The division of operands where the result is the quotient in which the digits after the decimal point are truncated. If however one of the operands is negative, the result is floored, i.e., rounded away from zero (towards negative infinity) \u2212<\/td>\r\n<td>9\/\/2 = 4 and 9.0\/\/2.0 = 4.0, -11\/\/3 = -4, -11.0\/\/3 = -4.0<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n\r\n<hr \/>\r\n<p>&nbsp;<\/p>\r\n\r\n<h4 class=\"wp-block-heading\">Python Comparison\/Relational Operators<\/h4>\r\n\r\n\r\n\r\n<p>Comparison Operators are used to compare two values on either side of the operator to see is they are equal or one is greater or less than the other. Comparison Operators are also known as Relational Operators.<\/p>\r\n\r\n\r\n\r\n<p>The table below gives a list and description of Python Comparison operators and an example for when x =10 and y = 20<\/p>\r\n\r\n\r\n\r\n<table class=\"wp-block-table is-style-stripes\">\r\n<tbody>\r\n<tr>\r\n<th>Operator<\/th>\r\n<th>Description<\/th>\r\n<th>Example<\/th>\r\n<\/tr>\r\n<tr>\r\n<td>==<\/td>\r\n<td>If the values of two operands are equal, then the condition evaluates to true.<\/td>\r\n<td>(x == y) is not true.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>!=<\/td>\r\n<td>If values of two operands are not equal, then condition evaluates to true.<\/td>\r\n<td>(x != y) is true.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>&lt;&gt;<\/td>\r\n<td>If values of two operands are not equal, then condition evaluates to true.<\/td>\r\n<td>(x &lt;&gt; y) is true. This is similar to != operator.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>&gt;<\/td>\r\n<td>If the value of left operand is greater than the value of right operand, then condition evaluates to true.<\/td>\r\n<td>(x &gt; y) is not true.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>&lt;<\/td>\r\n<td>If the value of left operand is less than the value of right operand, then condition evaluates to true.<\/td>\r\n<td>(x &lt; y) is true.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>&gt;=<\/td>\r\n<td>If the value of left operand is greater than or equal to the value of right operand, then condition evaluates to true.<\/td>\r\n<td>(x &gt;= y) is not true.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>&lt;=<\/td>\r\n<td>If the value of left operand is less than or equal to the value of right operand, then condition evaluates to true.<\/td>\r\n<td>(x &lt;= y) is true.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n\r\n<hr \/>\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n<h4 class=\"wp-block-heading\">Python Assignment Operators<\/h4>\r\n\r\n\r\n\r\n<p>Assignment operators are used to either assign a new value to a variable or to change the value of a variable to another value. The table below summarizes the result for x = 10 and y = 20<\/p>\r\n\r\n\r\n\r\n<table class=\"wp-block-table is-style-stripes\">\r\n<tbody>\r\n<tr>\r\n<th>Operator<\/th>\r\n<th>Description<\/th>\r\n<th>Example<\/th>\r\n<\/tr>\r\n<tr>\r\n<td>=<\/td>\r\n<td>Assigns values from right side operands to left side operand<\/td>\r\n<td>z = x + y assigns value of x + y into z<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>+= Add AND<\/td>\r\n<td>Adds the right operand to the left operand and assigns the result to left operand<\/td>\r\n<td>z += x is equivalent to z = z + x<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>-= Subtract AND<\/td>\r\n<td>Subtracts the right operand from the left operand and then assigns the result to left operand<\/td>\r\n<td>z -= x is equivalent to z = z &#8211; x<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>*= Multiply AND<\/td>\r\n<td>Multiplies right operand with the left operand and then assign the result to left operand<\/td>\r\n<td>z *= x is equivalent to <br \/>z = z * x<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\/= Divide AND<\/td>\r\n<td>Divides left operand with the right operand and assigns the result to left operand<\/td>\r\n<td>z \/= x is equivalent to z = z \/ xz \/= x is equivalent to z = z \/ x<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>%= Modulus AND<\/td>\r\n<td>Takes modulus using two operands and assign the result to left operand<\/td>\r\n<td>z %= x is equivalent to <br \/>z = z % x<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>**= Exponent AND<\/td>\r\n<td>It performs exponential calculation on operators and assign value to the left operand<\/td>\r\n<td>z **= x is equivalent to z = z ** x<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\/\/= Floor Division<\/td>\r\n<td>Performs floor division on operators and assign value to the left operand<\/td>\r\n<td>z \/\/= x is equivalent to <br \/>z = z \/\/ x<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n\r\n<hr \/>\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n<h4 class=\"wp-block-heading\">Python Bitwise Operators<\/h4>\r\n\r\n\r\n\r\n<p>Bitwise operators are special operators that are applied on binary number. The operation is carried out bit-by-bit. So given two number in decimal x = 60 and y = 13. We convert to the binary equivalent and apply the bitwise operation<\/p>\r\n\r\n\r\n\r\n<p>x = 00111100<\/p>\r\n\r\n\r\n\r\n<p>y = 00001101<\/p>\r\n\r\n\r\n\r\n<p>x &amp; y = 00001100<\/p>\r\n\r\n\r\n\r\n<p>x | y = 00111101<\/p>\r\n\r\n\r\n\r\n<p>x ^ y = 00110001<\/p>\r\n\r\n\r\n\r\n<p>~ x = 11000011<\/p>\r\n\r\n\r\n\r\n<p>The table below gives a summary of Python Bitwise operators and their description<\/p>\r\n\r\n\r\n\r\n<table class=\"wp-block-table is-style-stripes\">\r\n<tbody>\r\n<tr>\r\n<th>Operator<\/th>\r\n<th>Description<\/th>\r\n<th>Example<\/th>\r\n<\/tr>\r\n<tr>\r\n<td>&amp; (Binary AND)<\/td>\r\n<td>Produces a 1 if both bits are 1<\/td>\r\n<td>(x &amp; y) (means 0000 1100)<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>| (Binary OR)<\/td>\r\n<td>Produces a 1 is there is 1 in either of the operands<\/td>\r\n<td>(x | y) = 61 (means 0011 1101)<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>^ (Binary XOR)<\/td>\r\n<td>Copies the bit if it is set in one operand but not in both.<\/td>\r\n<td>(x ^ y) = 49 (means 0011 0001)<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>~ (Binary Ones Complement)<\/td>\r\n<td>Unary which has the effect of &#8216;flipping&#8217; bits. Chanes 1 to 0 and 0 to 1<\/td>\r\n<td>(~x ) = -61 (means 1100 0011 in 2&#8217;s complement form due to a signed binary number.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>&lt;&lt; (Binary Left Shift)<\/td>\r\n<td>Move the left operand to the left by the number of bits specified by the right operand.<\/td>\r\n<td>x &lt;&lt; 2 = 240 (means 1111 0000)<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>&gt;&gt; (Binary Right Shift)<\/td>\r\n<td>Moves the left operand to the right by the number of bits specified by the right operand.<\/td>\r\n<td>x &gt;&gt; 2 = 15 (means 0000 1111)<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n\r\n<hr \/>\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n<h4 class=\"wp-block-heading\">Python Logical Operators<\/h4>\r\n\r\n\r\n\r\n<p>Logical operators are used to perform logical comparison on operands. The table below summarizes the three Python logical operators for x = 10 and y = 20<\/p>\r\n\r\n\r\n\r\n<table class=\"wp-block-table is-style-stripes\">\r\n<tbody>\r\n<tr>\r\n<th>Operator<\/th>\r\n<th>Description<\/th>\r\n<th>Example<\/th>\r\n<\/tr>\r\n<tr>\r\n<td>and (Logical AND)<\/td>\r\n<td>If both the operands are true then condition becomes true.<\/td>\r\n<td>(x and y) is true.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>or (Logical OR)<\/td>\r\n<td>If any of the two operands are non-zero then condition becomes true.<\/td>\r\n<td>(x or y) is true.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>not (Logical NOT)<\/td>\r\n<td>Reverses the state of the given operand.<\/td>\r\n<td>Not(x and y) is false.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n\r\n<hr \/>\r\n<p>&nbsp;<\/p>\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n\r\n\r\n<h4 class=\"wp-block-heading\">Python Membership Operators<\/h4>\r\n\r\n\r\n\r\n<p>Membership operators are used to check is a given variable is a member of some collection such as list, string, tuple or dictionary. The two membership operators in Python are summarized below.<\/p>\r\n\r\n\r\n\r\n<table class=\"wp-block-table is-style-stripes\">\r\n<tbody>\r\n<tr>\r\n<th>Operator<\/th>\r\n<th>Description<\/th>\r\n<th>Example<\/th>\r\n<\/tr>\r\n<tr>\r\n<td>in<\/td>\r\n<td>Becomes true if it finds a variable in the given sequence and false if not.<\/td>\r\n<td>a in b, here in results in 1 if a is a member of sequence b.<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>not in<\/td>\r\n<td>Becomes true if it does not finds a variable in the given sequence and false if otherwise.<\/td>\r\n<td>a not in b, here not in results in a 1 if a is not a member of sequence b.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n\r\n<hr \/>\r\n<p>&nbsp;<\/p>\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n\r\n\r\n<h4 class=\"wp-block-heading\">Python Identity Operators<\/h4>\r\n\r\n\r\n\r\n<p>Identity operators are applied on Python objects. It compares the memory location of two objects. The two identity operators in Python are summarized below<\/p>\r\n\r\n\r\n\r\n<table class=\"wp-block-table is-style-stripes\">\r\n<tbody>\r\n<tr>\r\n<th>Operator<\/th>\r\n<th>Description<\/th>\r\n<th>Example<\/th>\r\n<\/tr>\r\n<tr>\r\n<td>is<\/td>\r\n<td>Resolves to true if the variables on both sides of the operator point to the same object in memory and false if not.<\/td>\r\n<td>a is b, here\u00a0<strong>is<\/strong>\u00a0results in 1 if id(a) equals id(b).<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>is not<\/td>\r\n<td>Resolves to false if variables on either side of the operator point to the same object and true if not.<\/td>\r\n<td>a is not b, here\u00a0<strong>is not<\/strong>\u00a0results in 1 if id(a) is not equal to id(b).<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n<p><b>Watch the Video<b><br \/><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/8Qo3rq-R-WI\" width=\"100%\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/b><\/b><\/p>","protected":false},"excerpt":{"rendered":"<p>Just as you know, operators are symbols used to perform various operations and get results. In programming terms we say operator work on operands. We &hellip; <\/p>\n","protected":false},"author":395,"featured_media":288,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-95","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python - Operators - Python Tutorials<\/title>\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.kindsonthegenius.com\/python\/05-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 - Python Tutorials\" \/>\n<meta property=\"og:description\" content=\"Just as you know, operators are symbols used to perform various operations and get results. In programming terms we say operator work on operands. We &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-11T01:17:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-31T21:09:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Operators-in-Python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"887\" \/>\n\t<meta property=\"og:image:height\" content=\"494\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"kindsonthegenius\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kindsonthegenius\" \/>\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\":\"Article\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/\"},\"author\":{\"name\":\"kindsonthegenius\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\"},\"headline\":\"Python &#8211; Operators\",\"datePublished\":\"2019-01-11T01:17:30+00:00\",\"dateModified\":\"2019-03-31T21:09:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/\"},\"wordCount\":1228,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/01\\\/Operators-in-Python.jpg\",\"articleSection\":[\"Python Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/\",\"name\":\"Python - Operators - Python Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/01\\\/Operators-in-Python.jpg\",\"datePublished\":\"2019-01-11T01:17:30+00:00\",\"dateModified\":\"2019-03-31T21:09:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/01\\\/Operators-in-Python.jpg\",\"contentUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/01\\\/Operators-in-Python.jpg\",\"width\":887,\"height\":494,\"caption\":\"Operators in Python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/05-python-operators\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python &#8211; Operators\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#website\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/\",\"name\":\"Python Tutorials\",\"description\":\"Python Tutorial for Programming and Data Science\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\",\"name\":\"kindsonthegenius\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"caption\":\"kindsonthegenius\"},\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/author\\\/kindsonthegenius-2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python - Operators - Python Tutorials","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.kindsonthegenius.com\/python\/05-python-operators\/","og_locale":"en_US","og_type":"article","og_title":"Python - Operators - Python Tutorials","og_description":"Just as you know, operators are symbols used to perform various operations and get results. In programming terms we say operator work on operands. We &hellip;","og_url":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/","og_site_name":"Python Tutorials","article_published_time":"2019-01-11T01:17:30+00:00","article_modified_time":"2019-03-31T21:09:05+00:00","og_image":[{"width":887,"height":494,"url":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Operators-in-Python.jpg","type":"image\/jpeg"}],"author":"kindsonthegenius","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kindsonthegenius","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/#article","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/"},"author":{"name":"kindsonthegenius","@id":"https:\/\/www.kindsonthegenius.com\/python\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2"},"headline":"Python &#8211; Operators","datePublished":"2019-01-11T01:17:30+00:00","dateModified":"2019-03-31T21:09:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/"},"wordCount":1228,"commentCount":1,"image":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Operators-in-Python.jpg","articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/","url":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/","name":"Python - Operators - Python Tutorials","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/#primaryimage"},"image":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Operators-in-Python.jpg","datePublished":"2019-01-11T01:17:30+00:00","dateModified":"2019-03-31T21:09:05+00:00","author":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2"},"breadcrumb":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/#primaryimage","url":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Operators-in-Python.jpg","contentUrl":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Operators-in-Python.jpg","width":887,"height":494,"caption":"Operators in Python"},{"@type":"BreadcrumbList","@id":"https:\/\/www.kindsonthegenius.com\/python\/05-python-operators\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.kindsonthegenius.com\/python\/"},{"@type":"ListItem","position":2,"name":"Python &#8211; Operators"}]},{"@type":"WebSite","@id":"https:\/\/www.kindsonthegenius.com\/python\/#website","url":"https:\/\/www.kindsonthegenius.com\/python\/","name":"Python Tutorials","description":"Python Tutorial for Programming and Data Science","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.kindsonthegenius.com\/python\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.kindsonthegenius.com\/python\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2","name":"kindsonthegenius","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","caption":"kindsonthegenius"},"url":"https:\/\/www.kindsonthegenius.com\/python\/author\/kindsonthegenius-2\/"}]}},"_links":{"self":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/users\/395"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":6,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":268,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts\/95\/revisions\/268"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/media\/288"}],"wp:attachment":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}