{"id":54,"date":"2026-03-01T15:12:41","date_gmt":"2026-03-01T10:12:41","guid":{"rendered":"https:\/\/gigz.pk\/python\/?post_type=lesson&#038;p=54"},"modified":"2026-03-13T09:22:13","modified_gmt":"2026-03-13T04:22:13","slug":"assignment-operators","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/python\/lesson\/assignment-operators\/","title":{"rendered":"\u00a0Assignment Operators"},"content":{"rendered":"\n<p>Assignment operators are used to assign values to variables in Python. They are essential for storing data and updating values during program execution. These operators make code shorter and more efficient when performing calculations and reassigning values.<\/p>\n\n\n\n<p>Understanding assignment operators is important for writing clean and optimized Python programs.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>SIMPLE ASSIGNMENT OPERATOR<\/strong><\/h1>\n\n\n\n<p>The simple assignment operator is represented by the equals sign.<\/p>\n\n\n\n<p>Symbol: =<\/p>\n\n\n\n<p>It assigns the value on the right side to the variable on the left side.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>x = 10<br>name = &#8220;Hira&#8221;<\/p>\n\n\n\n<p>Here, the value 10 is assigned to x, and the text Hira is assigned to name.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>ADDITION ASSIGNMENT OPERATOR<\/strong><\/h1>\n\n\n\n<p>Symbol: +=<\/p>\n\n\n\n<p>This operator adds a value to the existing variable and assigns the result back to the same variable.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>x = 5<br>x += 3<\/p>\n\n\n\n<p>Now x becomes 8.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>SUBTRACTION ASSIGNMENT OPERATOR<\/strong><\/h1>\n\n\n\n<p>Symbol: -=<\/p>\n\n\n\n<p>This subtracts a value from the variable and assigns the result.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>x = 10<br>x -= 4<\/p>\n\n\n\n<p>Now x becomes 6.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>MULTIPLICATION ASSIGNMENT OPERATOR<\/strong><\/h1>\n\n\n\n<p>Symbol: *=<\/p>\n\n\n\n<p>This multiplies the variable by a value and assigns the result.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>x = 6<br>x *= 2<\/p>\n\n\n\n<p>Now x becomes 12.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>DIVISION ASSIGNMENT OPERATOR<\/strong><\/h1>\n\n\n\n<p>Symbol: \/=<\/p>\n\n\n\n<p>This divides the variable by a value and assigns the result.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>x = 10<br>x \/= 2<\/p>\n\n\n\n<p>Now x becomes 5.0.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>FLOOR DIVISION ASSIGNMENT OPERATOR<\/strong><\/h1>\n\n\n\n<p>Symbol: \/\/=<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>x = 10<br>x \/\/= 3<\/p>\n\n\n\n<p>Now x becomes 3.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>MODULUS ASSIGNMENT OPERATOR<\/strong><\/h1>\n\n\n\n<p>Symbol: %=<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>x = 10<br>x %= 3<\/p>\n\n\n\n<p>Now x becomes 1.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>EXPONENT ASSIGNMENT OPERATOR<\/strong><\/h1>\n\n\n\n<p>Symbol: **=<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<p>x = 2<br>x **= 3<\/p>\n\n\n\n<p>Now x becomes 8.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>WHY ASSIGNMENT OPERATORS ARE IMPORTANT<\/strong><\/h1>\n\n\n\n<p>Assignment operators help update variable values efficiently. They reduce the need to write longer expressions and make the code more readable.<\/p>\n\n\n\n<p>Mastering assignment operators allows you to manage and manipulate data smoothly while building Python programs.<\/p>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773375826000\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/python\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">PYTHON FUNDAMENTALS (PYF) > Operators > Assignment Operators<\/span><\/span><\/div>","protected":false},"menu_order":14,"template":"","class_list":["post-54","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u00a0Assignment Operators - One Language. Endless Possibilities<\/title>\n<meta name=\"description\" content=\"Learn Python assignment operators like =, +=, -=, *=, \/= to assign and update variables efficiently in programs.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/python\/lesson\/assignment-operators\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u00a0Assignment Operators - One Language. Endless Possibilities\" \/>\n<meta property=\"og:description\" content=\"Learn Python assignment operators like =, +=, -=, *=, \/= to assign and update variables efficiently in programs.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/python\/lesson\/assignment-operators\/\" \/>\n<meta property=\"og:site_name\" content=\"One Language. Endless Possibilities\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-13T04:22:13+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/assignment-operators\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/assignment-operators\\\/\",\"name\":\"\u00a0Assignment Operators - One Language. Endless Possibilities\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\"},\"datePublished\":\"2026-03-01T10:12:41+00:00\",\"dateModified\":\"2026-03-13T04:22:13+00:00\",\"description\":\"Learn Python assignment operators like =, +=, -=, *=, \\\/= to assign and update variables efficiently in programs.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/assignment-operators\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/assignment-operators\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/assignment-operators\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PYTHON FUNDAMENTALS (PYF) > Operators > Assignment Operators\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\",\"name\":\"One Language. Endless Possibilities\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/python\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u00a0Assignment Operators - One Language. Endless Possibilities","description":"Learn Python assignment operators like =, +=, -=, *=, \/= to assign and update variables efficiently in programs.","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:\/\/gigz.pk\/python\/lesson\/assignment-operators\/","og_locale":"en_US","og_type":"article","og_title":"\u00a0Assignment Operators - One Language. Endless Possibilities","og_description":"Learn Python assignment operators like =, +=, -=, *=, \/= to assign and update variables efficiently in programs.","og_url":"https:\/\/gigz.pk\/python\/lesson\/assignment-operators\/","og_site_name":"One Language. Endless Possibilities","article_modified_time":"2026-03-13T04:22:13+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/python\/lesson\/assignment-operators\/","url":"https:\/\/gigz.pk\/python\/lesson\/assignment-operators\/","name":"\u00a0Assignment Operators - One Language. Endless Possibilities","isPartOf":{"@id":"https:\/\/gigz.pk\/python\/#website"},"datePublished":"2026-03-01T10:12:41+00:00","dateModified":"2026-03-13T04:22:13+00:00","description":"Learn Python assignment operators like =, +=, -=, *=, \/= to assign and update variables efficiently in programs.","breadcrumb":{"@id":"https:\/\/gigz.pk\/python\/lesson\/assignment-operators\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/python\/lesson\/assignment-operators\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/python\/lesson\/assignment-operators\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/python\/"},{"@type":"ListItem","position":2,"name":"PYTHON FUNDAMENTALS (PYF) > Operators > Assignment Operators"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/python\/#website","url":"https:\/\/gigz.pk\/python\/","name":"One Language. Endless Possibilities","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/python\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson\/54","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/media?parent=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}