{"id":10881,"date":"2022-12-02T09:36:56","date_gmt":"2022-12-02T09:36:56","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=10881"},"modified":"2023-01-02T13:10:46","modified_gmt":"2023-01-02T13:10:46","slug":"what-are-the-python-operator-and-how-to-use-them","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/","title":{"rendered":"What are the Python Operator and How to Use Them?"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg\" alt=\"\" \/><\/p>\n<p>The python operator is used to do operations on variable and their values. For example, if we want to add two numbers then we use + is called an operator. Let\u2019s see one example to understand operators in python.<\/p>\n<pre><code>num1 = 10\nnum2 = 20\nans = num1 + num2\nprint(ans)\n# output:- 30<\/code><\/pre>\n<p>In the above program, + is an operator while num1 and num2 are operands. In this article, we will see various types of operators in python.<\/p>\n<h2>Types of Operators in Python:-<\/h2>\n<p>There are different types of operators in python listed below.<\/p>\n<ul>\n<li>Arithmetic Operators<\/li>\n<li>Comparision Operators<\/li>\n<li>Logical Operators<\/li>\n<li>Bitwise Operators<\/li>\n<li>Assignment Operators<\/li>\n<li>Identity Operators<\/li>\n<li>Membership Operators<\/li>\n<\/ul>\n<h3>Arithmetic Operators:-<\/h3>\n<p>Arithmetic operators are used to performing basic arithmetic operations like addition, subtraction, multiplication, division, and others. All the arithmetic python operators are given in the below table.<\/p>\n<table>\n<thead>\n<tr>\n<th>Operator<\/th>\n<th>Syntax<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>+ (Addition)<\/td>\n<td>A+B<\/td>\n<td>adds A and B<\/td>\n<\/tr>\n<tr>\n<td>&#8211;\u00a0 (Subtraction)<\/td>\n<td>A-B<\/td>\n<td>subtract B from A<\/td>\n<\/tr>\n<tr>\n<td>*\u00a0 (Multiplication)<\/td>\n<td>A*B<\/td>\n<td>multiply A and B<\/td>\n<\/tr>\n<tr>\n<td>\/ (Division)<\/td>\n<td>A\/B<\/td>\n<td>divide A by B (result: float)<\/td>\n<\/tr>\n<tr>\n<td>\/\/ (Division)<\/td>\n<td>A\/\/B<\/td>\n<td>divide A by B (result: floor (int))<\/td>\n<\/tr>\n<tr>\n<td>% (Modulus)<\/td>\n<td>A%B<\/td>\n<td>gives reminder of A divide B<\/td>\n<\/tr>\n<tr>\n<td>** (Power)<\/td>\n<td>A**B<\/td>\n<td>gives A power of B<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Precedence order of operators are Parenthese, Exponential, Multiplication, Division, Addition, and Subtraction. Let\u2019s understand how to use all the python operators in code with an example.<\/p>\n<pre><code>A=18\nB=5\n\nadd = A+B\nsub = A-B\nmul = A*B\ndiv_float = A\/B\ndiv_floor = A\/\/B\nmod = A%B\npower = A**B\n\nprint(\"A + B = \"+str(add))\nprint(\"A - B = \"+str(sub))\nprint(\"A * B = \"+str(mul))\nprint(\"A \/ B = \"+str(div_float))\nprint(\"A \/\/ B = \"+str(div_floor))\nprint(\"A % B = \"+str(mod))\nprint(\"A ** B = \"+str(power))\n\nOutput:\n\nA + B = 23\nA - B = 13\nA * B = 90\nA \/ B = 3.6\nA \/\/ B = 3\nA % B = 3\nA ** B = 1889568<\/code><\/pre>\n<h3>Comparision Operator:-<\/h3>\n<p>Comparison operators are used to making a comparison between values of two operands. It gives output as True or False based on the comparison. All the Comparison Python Operators are given in the below table.<\/p>\n<table>\n<thead>\n<tr>\n<th>Operator<\/th>\n<th>Syntax<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\\== (Equal to)<\/td>\n<td>A==B<\/td>\n<td>return true if A and B are equal<\/td>\n<\/tr>\n<tr>\n<td>> (Greater than)<\/td>\n<td>A&gt;B<\/td>\n<td>return true if A is greater than B<\/td>\n<\/tr>\n<tr>\n<td>&lt; (Less than)<\/td>\n<td>A&lt;B<\/td>\n<td>return true if A is less than B<\/td>\n<\/tr>\n<tr>\n<td>!= (Not equal to)<\/td>\n<td>A!=B<\/td>\n<td>return true if A is not equal to B<\/td>\n<\/tr>\n<tr>\n<td>>= (Greater than or equal to)<\/td>\n<td>A&gt;=B<\/td>\n<td>return true if A is greater than or equal to B<\/td>\n<\/tr>\n<tr>\n<td>&lt;= (Less than or equal to)<\/td>\n<td>A&lt;=B<\/td>\n<td>return true if A is less than or equal to B<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let\u2019s understand above python operators using an example.<\/p>\n<pre><code>A=18\nB=5\n\nprint(\"A == B is \"+str(A==B))\nprint(\"A > B is \"+str(A>B))\nprint(\"A<B is\"+str(A<B))\nprint(\"A != B is \"+str(A!=B))\nprint(\"A >= B is \"+str(A>=B))\nprint(\"A < = B is \"+str(A <= B))\n\nOutput:\n\nA == B is False\nA > B is True\nA < B is False\nA != B is True\nA >= B is True\nA <= B is False<\/code><\/pre>\n<h3>Logical Operator:-<\/h3>\n<p>Logical operators are used to performing logical operations like logical AND, logical OR. and logical NOT. All the logical python operators are given in the below table.<\/p>\n<table>\n<thead>\n<tr>\n<th>Operator<\/th>\n<th>Syntax<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>and (Logical and)<\/td>\n<td>A and B<\/td>\n<td>Return true only if A and B both are true<\/td>\n<\/tr>\n<tr>\n<td>or (Logical or)<\/td>\n<td>A or B<\/td>\n<td>Return true if either A or B is true<\/td>\n<\/tr>\n<tr>\n<td>not (logical not)<\/td>\n<td>not A<\/td>\n<td>Return true if A is false and vice versa<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let\u2019s understand above python operators using an example.<\/p>\n<pre><code>A=True\nB=False\n\n_and = A and B\n_or = A or B\n_not = not A\nprint(\"A and B = \"+str(_and))\nprint(\"A or B = \"+str(_or))\nprint(\"not A = \"+str(_not))\n\nOutput:\n\nA and B = False\nA or B = True\nnot A = False<\/code><\/pre>\n<h3>Bitwise Operator:-<\/h3>\n<p>Bitwise operators are used to performing bitwise operations like bitwise and, bitwise or and many more. All the Bitwise Python Operators are given in the below table.<\/p>\n<table>\n<thead>\n<tr>\n<th>Operator<\/th>\n<th>Syntax<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>&amp; (Bitwise and)<\/td>\n<td>A &amp; B<\/td>\n<td>return A bitwise and B<\/td>\n<\/tr>\n<tr>\n<td>(Bitwise or)<\/td>\n<td>A<\/td>\n<td>B<\/td>\n<td>return A bitwise or B<\/td>\n<\/tr>\n<tr>\n<td>~ (Bitwise not)<\/td>\n<td>~ A<\/td>\n<td>return bitwise not of A<\/td>\n<\/tr>\n<tr>\n<td>^ (Bitwise xor)<\/td>\n<td>A ^ B<\/td>\n<td>return A bitwise xor B<\/td>\n<\/tr>\n<tr>\n<td>>&gt; (Bitwise right shift)<\/td>\n<td>A &gt;&gt; B<\/td>\n<td>return A right shift by B<\/td>\n<\/tr>\n<tr>\n<td>&lt;&lt; (Bitwise left shift)<\/td>\n<td>A &lt;&lt; B<\/td>\n<td>return A left shift by B<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let\u2019s understand bitwise python operators with help of an example.<\/p>\n<pre><code>A=8\nB=3\n\n_and = A & B\n_or = A | B\n_not = ~ A\n_xor = A ^ B\n_right_shift = A >> B\n_left_shift = A << B\nprint(\"A &#038; B = \"+str(_and))\nprint(\"A | B = \"+str(_or))\nprint(\"~ A = \"+str(_not))\nprint(\"A ^ B = \"+str(_xor))\nprint(\"A >> B = \"+str(_right_shift))\nprint(\"A << B = \"+str(_left_shift))\n\nOutput:\n\nA &#038; B = 0\nA | B = 11\n~ A = -9\nA ^ B = 11\nA >> B = 1\nA << B = 64<\/code><\/pre>\n<h3>Assignment Operator:-<\/h3>\n<p>Assignment operators are used to assign values to python variables. All the Assignment Python Operators are given in the below table.<\/p>\n<table>\n<thead>\n<tr>\n<th>Operator<\/th>\n<th>Syntax<\/th>\n<th>Same As<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\\=<\/td>\n<td>A=10<\/td>\n<td>A=10<\/td>\n<td>Assign value 10 to variable A<\/td>\n<\/tr>\n<tr>\n<td>+=<\/td>\n<td>A+=B<\/td>\n<td>A=A+B<\/td>\n<td>Add value B into the value of variable A and assign it to variable A<\/td>\n<\/tr>\n<tr>\n<td>-=<\/td>\n<td>A-=B<\/td>\n<td>A=A-B<\/td>\n<td>Subtract the value of B from the value of A and assign it to variable A<\/td>\n<\/tr>\n<tr>\n<td>*=<\/td>\n<td>A*=B<\/td>\n<td>A=A*B<\/td>\n<td>Multiply the values of A and B and assign it to variable A<\/td>\n<\/tr>\n<tr>\n<td>\/=<\/td>\n<td>A\/=B<\/td>\n<td>A=A\/B<\/td>\n<td>Divide value of A by B and assign it\u2019s float value to variable A<\/td>\n<\/tr>\n<tr>\n<td>\/\/=<\/td>\n<td>A\/\/=B<\/td>\n<td>A=A\/\/B<\/td>\n<td>Divide value of A by B and assign it\u2019s floor value to variable A<\/td>\n<\/tr>\n<tr>\n<td>%=<\/td>\n<td>A%=B<\/td>\n<td>A=A%B<\/td>\n<td>Get A modulus of B and assign it to variable A<\/td>\n<\/tr>\n<tr>\n<td>**=<\/td>\n<td>A**=B<\/td>\n<td>A=A**B<\/td>\n<td>Get A power of B and assign it to variable A<\/td>\n<\/tr>\n<tr>\n<td>&amp;=<\/td>\n<td>A&amp;=B<\/td>\n<td>A=A&amp;B<\/td>\n<td>Get bitwise and of A and B and assign it to variable A<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>=<\/td>\n<td>A<\/td>\n<td>=B<\/td>\n<td>A=A<\/td>\n<td>B<\/td>\n<td>Get bitwise or of A and B and assign it to variable A<\/td>\n<\/tr>\n<tr>\n<td>^=<\/td>\n<td>A^=B<\/td>\n<td>A=A^B<\/td>\n<td>Get bitwise xor of A and B and assign it to variable A<\/td>\n<\/tr>\n<tr>\n<td>>&gt;=<\/td>\n<td>A&gt;&gt;=B<\/td>\n<td>A=A&gt;&gt;B<\/td>\n<td>Get A left shift by B and assign it to variable A<\/td>\n<\/tr>\n<tr>\n<td>&lt;&lt;=<\/td>\n<td>A&lt;&lt;=B<\/td>\n<td>A=A&lt;&lt;B<\/td>\n<td>Get A left shift by B and assign it to variable A<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let\u2019s understand Assignment Python Operators with help of an example.<\/p>\n<pre><code>A,B=8,3\nA+=B\nprint(\"'A += B' = \"+str(A))\n\nA,B=8,3\nA-=B\nprint(\"'A -= B' = \"+str(A))\n\nA,B=8,3\nA*=B\nprint(\"'A *= B' = \"+str(A))\n\nA,B=8,3\nA\/=B\nprint(\"'A \/= B' = \"+str(A))\n\nA,B=8,3\nA\/\/=B\nprint(\"'A \/\/= B' = \"+str(A))\n\nOutput:-\n\n'A += B' = 11\n'A -= B' = 5\n'A *= B' = 24\n'A \/= B' = 2.6666666666666665\n'A \/\/= B' = 2<\/code><\/pre>\n<h3>Identity Operator:-<\/h3>\n<p>Identity operators are used to check whether the memory locations of values of two variable are same or not. All the Identity Python Operators are given in the below table.<\/p>\n<table>\n<thead>\n<tr>\n<th>Operator<\/th>\n<th>Syntax<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>is<\/td>\n<td>A is B<\/td>\n<td>Return true if memory locations of A and B are the same else return false.<\/td>\n<\/tr>\n<tr>\n<td>is not<\/td>\n<td>A is not B<\/td>\n<td>Return true if memory locations of A and B are not the same else return false<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let\u2019s understand identity python operators with help of an example.<\/p>\n<pre><code>A=10\nB=5\nC=A\nprint(A is B)\nprint(A is not B)\nprint(A is C)\n\nOutput:-\n\nFalse\nTrue\nTrue<\/code><\/pre>\n<h3>Membership operators:-<\/h3>\n<p>Membership operators are used to check whether an operand belongs to any group like list, tuple, set. All the Membership Python Operators are given in the below table.<\/p>\n<table>\n<thead>\n<tr>\n<th>Operator<\/th>\n<th>Syntax<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>in<\/td>\n<td>A in B<\/td>\n<td>Return true if A belongs to B else return False<\/td>\n<\/tr>\n<tr>\n<td>not in<\/td>\n<td>A not in B<\/td>\n<td>Return true if A does not belong to B else return False<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let\u2019s understand membership python operators with help of an example.<\/p>\n<pre><code>_list=[\"C\",\"C++\",\"Java\",\"Python\"]\n\nprint(\"Python\" in _list)\nprint(\"PHP\" in _list)\nprint(\"Python\" not in _list)\nprint(\"PHP\" not in _list)\n\nOutput:\n\nTrue\nFalse\nFalse\nTrue<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The python operator is used to do operations on variable and their values. For example, if we want to add two numbers then we use + is called an operator. Let\u2019s see one example to understand operators in python. num1 = 10 num2 = 20 ans = num1 + num2 print(ans) # output:- 30 In [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"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":[154],"tags":[],"class_list":["post-10881","post","type-post","status-publish","format-standard","hentry","category-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What are the Python Operator and How to Use Them?<\/title>\n<meta name=\"description\" content=\"The python operator is used to do operations on variable and their values. There are different types of operators in python listed here.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What are the Python Operator and How to Use Them?\" \/>\n<meta property=\"og:description\" content=\"The python operator is used to do operations on variable and their values. There are different types of operators in python listed here.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-02T09:36:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-02T13:10:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg\" \/>\n<meta name=\"author\" content=\"Prepbytes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prepbytes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"What are the Python Operator and How to Use Them?\",\"datePublished\":\"2022-12-02T09:36:56+00:00\",\"dateModified\":\"2023-01-02T13:10:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/\"},\"wordCount\":1005,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/\",\"name\":\"What are the Python Operator and How to Use Them?\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg\",\"datePublished\":\"2022-12-02T09:36:56+00:00\",\"dateModified\":\"2023-01-02T13:10:46+00:00\",\"description\":\"The python operator is used to do operations on variable and their values. There are different types of operators in python listed here.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/43.205.93.38\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/prepbytes.com\/blog\/category\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"What are the Python Operator and How to Use Them?\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/43.205.93.38\/#website\",\"url\":\"http:\/\/43.205.93.38\/\",\"name\":\"PrepBytes Blog\",\"description\":\"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING\",\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/43.205.93.38\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/43.205.93.38\/#organization\",\"name\":\"Prepbytes\",\"url\":\"http:\/\/43.205.93.38\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"contentUrl\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"width\":160,\"height\":160,\"caption\":\"Prepbytes\"},\"image\":{\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/prepbytes0211\/\",\"https:\/\/www.instagram.com\/prepbytes\/\",\"https:\/\/www.linkedin.com\/company\/prepbytes\/\",\"https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\",\"name\":\"Prepbytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"caption\":\"Prepbytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What are the Python Operator and How to Use Them?","description":"The python operator is used to do operations on variable and their values. There are different types of operators in python listed here.","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:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/","og_locale":"en_US","og_type":"article","og_title":"What are the Python Operator and How to Use Them?","og_description":"The python operator is used to do operations on variable and their values. There are different types of operators in python listed here.","og_url":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2022-12-02T09:36:56+00:00","article_modified_time":"2023-01-02T13:10:46+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg","type":"","width":"","height":""}],"author":"Prepbytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Prepbytes","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"What are the Python Operator and How to Use Them?","datePublished":"2022-12-02T09:36:56+00:00","dateModified":"2023-01-02T13:10:46+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/"},"wordCount":1005,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/","url":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/","name":"What are the Python Operator and How to Use Them?","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg","datePublished":"2022-12-02T09:36:56+00:00","dateModified":"2023-01-02T13:10:46+00:00","description":"The python operator is used to do operations on variable and their values. There are different types of operators in python listed here.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669808026696-Python%20Operator.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/what-are-the-python-operator-and-how-to-use-them\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/43.205.93.38\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/prepbytes.com\/blog\/category\/python\/"},{"@type":"ListItem","position":3,"name":"What are the Python Operator and How to Use Them?"}]},{"@type":"WebSite","@id":"http:\/\/43.205.93.38\/#website","url":"http:\/\/43.205.93.38\/","name":"PrepBytes Blog","description":"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING","publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/43.205.93.38\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/43.205.93.38\/#organization","name":"Prepbytes","url":"http:\/\/43.205.93.38\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/","url":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","contentUrl":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","width":160,"height":160,"caption":"Prepbytes"},"image":{"@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/prepbytes0211\/","https:\/\/www.instagram.com\/prepbytes\/","https:\/\/www.linkedin.com\/company\/prepbytes\/","https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA"]},{"@type":"Person","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e","name":"Prepbytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","caption":"Prepbytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/10881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=10881"}],"version-history":[{"count":2,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/10881\/revisions"}],"predecessor-version":[{"id":10883,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/10881\/revisions\/10883"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=10881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=10881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=10881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}