{"id":113538,"date":"2025-11-25T12:59:09","date_gmt":"2025-11-25T07:29:09","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/?page_id=113538"},"modified":"2025-11-25T12:38:42","modified_gmt":"2025-11-25T07:08:42","slug":"python-operators","status":"publish","type":"page","link":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/","title":{"rendered":"Python Operators"},"content":{"rendered":"\n<h1 id=\"python-operators-types-and-examples\">Python Operators: Types and Examples<\/h1>\n\n<h2 id=\"what-are-python-operators\">What Are Python Operators?<\/h2>\n<p>\n    An operator is a symbol that tells Python to perform a specific mathematical, relational, or logical operation. You use operators to manipulate variables and values to get a result. You can add numbers, compare data, or combine conditional statements with them.\n<\/p>\n<p>\n    For example, in the expression <code>10 + 5<\/code>, the <code>+<\/code> is the operator and <code>10<\/code> and <code>5<\/code> are the operands.\n<\/p>\n\n\n<h2 id=\"arithmetic-operators\">Arithmetic Operators<\/h2>\n<p>\n    Arithmetic operators perform common mathematical calculations. You use them with numeric data types like integers and floats.\n<\/p>\n\n<div style=\"overflow-x: auto; margin-bottom: 20px;\">\n    <table style=\"width: 100%; border-collapse: collapse; min-width: 600px;\">\n        <tr style=\"background-color: #f4f4f4;\">\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Operator<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Name<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Example<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Result<\/th>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>+<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Addition<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 + 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>15<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>-<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Subtraction<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 - 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>5<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>*<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Multiplication<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 * 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>50<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>\/<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Division<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 \/ 3<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>3.33<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>%<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Modulus<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 % 3<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>1<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>**<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Exponentiation<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 ** 2<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>100<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>\/\/<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Floor Division<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 \/\/ 3<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>3<\/code><\/td>\n        <\/tr>\n    <\/table>\n<\/div>\n\n<p>\n    Floor division (<code>\/\/<\/code>) divides and rounds the result down to the nearest whole number. The modulus operator (<code>%<\/code>) returns the remainder of a division.\n<\/p>\n\n<h2 id=\"assignment-operators\">Assignment Operators<\/h2>\n<p>\n    Assignment operators assign values to variables. The most common is the simple assignment operator (<code>=<\/code>), but Python also gives you compound operators that combine an arithmetic operation with an assignment.\n<\/p>\n<p>\n    For example, <code>x += 5<\/code> is a shorthand way to write <code>x = x + 5<\/code>.\n<\/p>\n\n<div style=\"overflow-x: auto; margin-bottom: 20px;\">\n    <table style=\"width: 100%; border-collapse: collapse; min-width: 600px;\">\n        <tr style=\"background-color: #f4f4f4;\">\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Operator<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Example<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Equivalent To<\/th>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>=<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>x = 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>x = 5<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>+=<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>x += 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>x = x + 5<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>-=<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>x -= 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>x = x - 5<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>*=<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>x *= 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>x = x * 5<\/code><\/td>\n        <\/tr>\n    <\/table>\n<\/div>\n\n\n<h2 id=\"comparison-operators\">Comparison Operators<\/h2>\n<p>\n    Comparison operators compare two values and return a Boolean result. The result is either <code>True<\/code> or <code>False<\/code>, which you need for conditional logic in if statements and while loops.\n<\/p>\n\n<div style=\"overflow-x: auto; margin-bottom: 20px;\">\n    <table style=\"width: 100%; border-collapse: collapse; min-width: 600px;\">\n        <tr style=\"background-color: #f4f4f4;\">\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Operator<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Name<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Example<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Result<\/th>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>==<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Equal to<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 == 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>False<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>!=<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Not equal to<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 != 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>True<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>><\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Greater than<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 > 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>True<\/code><\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>&lt;<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Less than<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>10 < 5<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>False<\/code><\/td>\n        <\/tr>\n    <\/table>\n<\/div>\n\n<h2 id=\"logical-operators\">Logical Operators<\/h2>\n<p>\n    Logical operators combine conditional statements and return <code>True<\/code> or <code>False<\/code>. You use them to create complex decision-making logic.\n<\/p>\n<ul>\n    <li><strong><code>and<\/code><\/strong>: Returns <code>True<\/code> if both statements are true<\/li>\n    <li><strong><code>or<\/code><\/strong>: Returns <code>True<\/code> if at least one of the statements is true<\/li>\n    <li><strong><code>not<\/code><\/strong>: Reverses the Boolean value of a statement<\/li>\n<\/ul>\n\n<h4 id=\"example-logical-operators-in-action\">Example: Logical Operators in Action<\/h4>\n<div class=\"code-editor-container\">\n    <div id=\"editor-logical\" class=\"python-code-editor\">\nx = 10\ny = 5\n\n# Example for 'and'\nprint(x > 5 and y < 10)  \n\n# Example for 'or'\nprint(x > 15 or y < 10)  \n\n# Example for 'not'\nprint(not(x > 5 and y < 10))  \n    <\/div>\n    <div class=\"button-container\">\n        <button class=\"button button-run\" onclick=\"runPythonCode('editor-logical', 'output-logical')\">Run Code<\/button>\n        <button class=\"button button-toggle\" onclick=\"toggleSolution('solution-logical', this)\">Show Example<\/button>\n    <\/div>\n\n    <div id=\"solution-logical\" class=\"code-solution\">\n        <pre><code>x = 10\ny = 5\n\nprint(x > 5 and y < 10)\nprint(x > 15 or y < 10)\nprint(not(x > 5 and y < 10))<\/code><\/pre>\n    <\/div>\n\n    <label for=\"output-logical\" class=\"output-label\">Output:<\/label>\n    <pre id=\"output-logical\" class=\"code-output\">Your output will appear here...<\/pre>\n<\/div>\n\n\n<h2 id=\"identity-operators\">Identity Operators<\/h2>\n<p>\n    Identity operators compare the memory locations of two objects. They check if two operands are the exact same object, not just if they have equal values.\n<\/p>\n<ul>\n    <li><strong><code>is<\/code><\/strong>: Returns <code>True<\/code> if both variables point to the same object<\/li>\n    <li><strong><code>is not<\/code><\/strong>: Returns <code>True<\/code> if the variables point to different objects<\/li>\n<\/ul>\n\n<h3 id=\"is-vs-value-vs-identity\"><code>is<\/code> vs <code>==<\/code> (Value vs. Identity)<\/h3>\n<p>\n    The <code>==<\/code> operator compares the values of two objects, while the <code>is<\/code> operator checks if they're the same object in memory. This is a key difference between checking for equality and checking for identity.\n<\/p>\n\n<div class=\"code-editor-container\">\n    <div id=\"editor-identity\" class=\"python-code-editor\">\nlist_a = [1, 2, 3]\nlist_b = [1, 2, 3]\nlist_c = list_a\n\n# Compares the values, which are the same\nprint(list_a == list_b)  \n\n# Compares the memory location, which is different\nprint(list_a is list_b)  \n\n# list_c points to the same object as list_a\nprint(list_a is list_c)  \n    <\/div>\n    <div class=\"button-container\">\n        <button class=\"button button-run\" onclick=\"runPythonCode('editor-identity', 'output-identity')\">Run Code<\/button>\n        <button class=\"button button-toggle\" onclick=\"toggleSolution('solution-identity', this)\">Show Example<\/button>\n    <\/div>\n\n    <div id=\"solution-identity\" class=\"code-solution\">\n        <pre><code>list_a = [1, 2, 3]\nlist_b = [1, 2, 3]\nlist_c = list_a\n\nprint(list_a == list_b)\nprint(list_a is list_b)\nprint(list_a is list_c)<\/code><\/pre>\n    <\/div>\n\n    <label for=\"output-identity\" class=\"output-label\">Output:<\/label>\n    <pre id=\"output-identity\" class=\"code-output\">Your output will appear here...<\/pre>\n    <div class=\"insight-box\"> <strong>Analysis:<\/strong> While <code>list_a<\/code> and <code>list_b<\/code> contain the same elements, they're two separate list objects stored in different memory locations. However, <code>list_c<\/code> is another name for the same object that <code>list_a<\/code> refers to.<\/div>\n<\/div>\n\n<h2 id=\"membership-operators\">Membership Operators<\/h2>\n<p>\n    Membership operators test if a sequence is present in an object, such as a string, list, or tuple. They return <code>True<\/code> or <code>False<\/code>.\n<\/p>\n<ul>\n    <li><strong><code>in<\/code><\/strong>: Returns <code>True<\/code> if Python finds a value in the sequence<\/li>\n    <li><strong><code>not in<\/code><\/strong>: Returns <code>True<\/code> if Python doesn't find a value in the sequence<\/li>\n<\/ul>\n\n<div class=\"code-editor-container\">\n    <div id=\"editor-membership\" class=\"python-code-editor\">\nmy_list = [10, 20, 30, 40]\nmy_string = \"hello world\"\n\n# Example for 'in'\nprint(20 in my_list)  \nprint(\"hello\" in my_string)  \n\n# Example for 'not in'\nprint(50 not in my_list)  \n    <\/div>\n    <div class=\"button-container\">\n        <button class=\"button button-run\" onclick=\"runPythonCode('editor-membership', 'output-membership')\">Run Code<\/button>\n        <button class=\"button button-toggle\" onclick=\"toggleSolution('solution-membership', this)\">Show Example<\/button>\n    <\/div>\n\n    <div id=\"solution-membership\" class=\"code-solution\">\n        <pre><code>my_list = [10, 20, 30, 40]\nmy_string = \"hello world\"\n\nprint(20 in my_list)\nprint(\"hello\" in my_string)\nprint(50 not in my_list)<\/code><\/pre>\n    <\/div>\n\n    <label for=\"output-membership\" class=\"output-label\">Output:<\/label>\n    <pre id=\"output-membership\" class=\"code-output\">Your output will appear here...<\/pre>\n<\/div>\n\n<h2 id=\"bitwise-operators\">Bitwise Operators<\/h2>\n<p>\n    Bitwise operators perform operations on integers at the binary level. You usually use them for lower-level programming tasks, such as working with device drivers or network packets. They're less common in general application development.\n<\/p>\n\n<div style=\"overflow-x: auto; margin-bottom: 20px;\">\n    <table style=\"width: 100%; border-collapse: collapse; min-width: 600px;\">\n        <tr style=\"background-color: #f4f4f4;\">\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Operator<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Name<\/th>\n            <th style=\"border: 1px solid #ddd; padding: 12px; text-align: left;\">Description<\/th>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>&<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">AND<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Sets each bit to 1 if both bits are 1<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>|<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">OR<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Sets each bit to 1 if one of two bits is 1<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>^<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">XOR<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Sets each bit to 1 if only one of two bits is 1<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>~<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">NOT<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Inverts all the bits<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>&lt;&lt;<\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Zero fill left shift<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Shifts bits to the left, pushing zeros in from the right<\/td>\n        <\/tr>\n        <tr>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\"><code>>><\/code><\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Signed right shift<\/td>\n            <td style=\"border: 1px solid #ddd; padding: 12px;\">Shifts bits to the right, pushing copies of the leftmost bit in from the left<\/td>\n        <\/tr>\n    <\/table>\n<\/div>\n\n\n<div class=\"cta-final\">\n    <div class=\"cta-final-header\">\n        <span class=\"cta-final-trophy\">\ud83c\udfc6<\/span>\n        <h2 id=\"lesson-completed\">Lesson Completed<\/h2>\n    <\/div>\n\n    <p class=\"cta-final-intro\">\n        You have learned about all Types of Python Operators. Next, learn Each Operators in Detail.\n    <\/p>\n\n    <div class=\"cta-final-grid\">\n        <div class=\"cta-final-option\">\n            <div class=\"cta-final-option-header\">\n                <span>\ud83d\udcd8<\/span>\n                <h4 id=\"full-python-course\">Full Python Course<\/h4>\n            <\/div>\n            <p>Master Python with 11+ hours of content, 50+ exercises, and real-world projects.<\/p>\n            <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/master-python-programming?utm_source=blog\" class=\"cta-final-button-primary\">Enroll Now<\/a>\n        <\/div>\n\n        <div class=\"cta-final-option\" id=\"pt-next-lesson-container\">\n            <div class=\"cta-final-option-header\">\n                <span>\ud83d\udcdd<\/span>\n                <h4 id=\"next-lesson\">Next Lesson<\/h4>\n            <\/div>\n            <p id=\"pt-next-lesson-text\">Continue with the next lesson on Python Control Flow.<\/p>\n            <a href=\"#\" id=\"pt-next-lesson-button\" class=\"cta-final-button-secondary\">Next Lesson -><\/a>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn about Python operators: arithmetic, assignment, comparison, logical, identity, membership, and bitwise. Understand with examples.<\/p>\n","protected":false},"author":41,"featured_media":113550,"parent":113156,"menu_order":13,"comment_status":"closed","ping_status":"closed","template":"templates\/python-tutorial.php","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[25860],"tags":[36796,36893],"class_list":["post-113538","page","type-page","status-publish","has-post-thumbnail","hentry","category-software","tag-python","tag-python-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Learn Python Operators<\/title>\n<meta name=\"description\" content=\"Learn about Python operators: arithmetic, assignment, comparison, logical, identity, membership, and bitwise. Understand with 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.mygreatlearning.com\/blog\/python\/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\" \/>\n<meta property=\"og:description\" content=\"Learn about Python operators: arithmetic, assignment, comparison, logical, identity, membership, and bitwise. Understand with examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1408\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"Python Operators\",\"datePublished\":\"2025-11-25T07:29:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/\"},\"wordCount\":675,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/python-operators.webp\",\"keywords\":[\"python\",\"python-tutorial\"],\"articleSection\":[\"IT\\\/Software Development\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/\",\"name\":\"Learn Python Operators\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/python-operators.webp\",\"datePublished\":\"2025-11-25T07:29:09+00:00\",\"description\":\"Learn about Python operators: arithmetic, assignment, comparison, logical, identity, membership, and bitwise. Understand with examples.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/python-operators.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/python-operators.webp\",\"width\":1408,\"height\":768,\"caption\":\"Python Operators\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/python-operators\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Tutorial\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python Operators\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Learn Python Operators","description":"Learn about Python operators: arithmetic, assignment, comparison, logical, identity, membership, and bitwise. Understand with 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.mygreatlearning.com\/blog\/python\/python-operators\/","og_locale":"en_US","og_type":"article","og_title":"Python Operators","og_description":"Learn about Python operators: arithmetic, assignment, comparison, logical, identity, membership, and bitwise. Understand with examples.","og_url":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","og_image":[{"width":1408,"height":768,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators.webp","type":"image\/webp"}],"twitter_card":"summary_large_image","twitter_site":"@Great_Learning","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"Python Operators","datePublished":"2025-11-25T07:29:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/"},"wordCount":675,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators.webp","keywords":["python","python-tutorial"],"articleSection":["IT\/Software Development"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/","url":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/","name":"Learn Python Operators","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators.webp","datePublished":"2025-11-25T07:29:09+00:00","description":"Learn about Python operators: arithmetic, assignment, comparison, logical, identity, membership, and bitwise. Understand with examples.","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators.webp","width":1408,"height":768,"caption":"Python Operators"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/python\/python-operators\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python Tutorial","item":"https:\/\/www.mygreatlearning.com\/blog\/python\/"},{"@type":"ListItem","position":3,"name":"Python Operators"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators.webp",1408,768,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators-150x150.webp",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators-300x164.webp",300,164,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators-768x419.webp",768,419,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators-1024x559.webp",1024,559,true],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators.webp",1408,768,false],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators.webp",1408,768,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators-640x768.webp",640,768,true],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators-96x96.webp",96,96,true],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2025\/11\/python-operators-150x82.webp",150,82,true]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":0,"uagb_excerpt":"Learn about Python operators: arithmetic, assignment, comparison, logical, identity, membership, and bitwise. Understand with examples.","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/pages\/113538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=113538"}],"version-history":[{"count":13,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/pages\/113538\/revisions"}],"predecessor-version":[{"id":113551,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/pages\/113538\/revisions\/113551"}],"up":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/pages\/113156"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/113550"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=113538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=113538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=113538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}