{"id":212,"date":"1997-07-01T11:18:45","date_gmt":"1997-07-01T11:18:45","guid":{"rendered":"http:\/\/python-tutorials.com\/?p=212"},"modified":"2016-01-15T15:17:34","modified_gmt":"2016-01-15T15:17:34","slug":"assignment-operators","status":"publish","type":"post","link":"https:\/\/geek-university.com\/python\/assignment-operators\/","title":{"rendered":"Assignment operators"},"content":{"rendered":"<p><span style=\"font-size: 12pt; color: #313b3d;\">The<strong> assignment operators<\/strong>\u00a0in Python are used to store data into a variable. We&#8217;ve already used the most common assingment operator (<strong>=<\/strong>), but there are many more of them:<\/span><\/p>\n<ul>\n<li><span style=\"font-size: 12pt; color: #313b3d;\"><strong>=<\/strong> &#8211; assigns the value found in the right operands to the left operand. Example: x = 5.<\/span><\/li>\n<li><span style=\"font-size: 12pt; color: #313b3d;\"><strong>+=<\/strong> &#8211; adds the value found in the right operand to the value found in the left operand. Example: x = 5, x += 3 results in x = 8.<\/span><\/li>\n<li><span style=\"font-size: 12pt; color: #313b3d;\"><strong>-=<\/strong> &#8211; substracts the value of the right operand from the value found in the left operand. Example: x = 5, x -= 3 results in x = 2.<\/span><\/li>\n<li><span style=\"font-size: 12pt; color: #313b3d;\"><strong>*=<\/strong> &#8211; multiplies the value of the right operand by the value of the left operand. Example: x = 5, x *= 3 results in x = 15.<\/span><\/li>\n<li><span style=\"font-size: 12pt; color: #313b3d;\"><strong>\/=<\/strong> &#8211; divides the value of the left operand by the value of the right operand. Example: x = 5, x \/=3 results in x = 1.667.<\/span><\/li>\n<li><span style=\"font-size: 12pt; color: #313b3d;\"><strong>%=<\/strong> &#8211; divides the value found in the left operand by the value found in the right operand. The reminder will be placed in the left operand. Example: x = 5, x %=3 results in x = 2.<\/span><\/li>\n<li><span style=\"font-size: 12pt; color: #313b3d;\"><strong>**=<\/strong> &#8211; determines the exponential value found in the left operand when raised to the power of the value in the right operand. Example: x = 5, x **=3 results in x = 125.<\/span><\/li>\n<li><span style=\"font-size: 12pt; color: #313b3d;\"><strong>\/\/=<\/strong> &#8211; divides the value found in the left operand by the value of the right operand. The integer result will be placed in the left operand. Example: x = 5, x \/\/= 3 results in x = 1.<\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The assignment operators\u00a0in Python are used to store data into a variable. We&#8217;ve already used the most common assingment operator &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[840],"tags":[],"class_list":["post-212","post","type-post","status-publish","format-standard","hentry","category-python"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/geek-university.com\/wp-json\/wp\/v2\/posts\/212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geek-university.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geek-university.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geek-university.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geek-university.com\/wp-json\/wp\/v2\/comments?post=212"}],"version-history":[{"count":2,"href":"https:\/\/geek-university.com\/wp-json\/wp\/v2\/posts\/212\/revisions"}],"predecessor-version":[{"id":4191,"href":"https:\/\/geek-university.com\/wp-json\/wp\/v2\/posts\/212\/revisions\/4191"}],"wp:attachment":[{"href":"https:\/\/geek-university.com\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geek-university.com\/wp-json\/wp\/v2\/categories?post=212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geek-university.com\/wp-json\/wp\/v2\/tags?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}