{"id":782,"date":"2020-10-26T05:22:38","date_gmt":"2020-10-26T05:22:38","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=782"},"modified":"2025-03-27T13:25:48","modified_gmt":"2025-03-27T13:25:48","slug":"python-mutable-and-immutable","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/advanced-python\/python-mutable-and-immutable\/","title":{"rendered":"Python Mutable and Immutable"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn about the mutable and immutable in Python.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-mutable-and-immuable-in-python'>Introduction to mutable and immuable in Python <a href=\"#introduction-to-mutable-and-immuable-in-python\" class=\"anchor\" id=\"introduction-to-mutable-and-immuable-in-python\" title=\"Anchor for Introduction to mutable and immuable in Python\">#<\/a><\/h2>\n\n\n\n<p>In Python, everything is an object. An object has its own internal state. Some objects allow you to change their internal state and others don&#8217;t.<\/p>\n\n\n\n<p>An object whose internal state can be changed is called a mutable object, while an object whose internal state cannot be changed is called an immutable object.<\/p>\n\n\n\n<p>The following are examples of immutable objects:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-numbers\/\">Numbers<\/a> (<a href=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-integers\/\">int<\/a>, <a href=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-float\/\">float<\/a>, <a href=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-bool\/\">bool<\/a>,&#8230;)<\/li>\n\n\n\n<li><a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-string\/\">Strings<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-tuples\/\">Tuples<\/a><\/li>\n\n\n\n<li>Frozen sets<\/li>\n<\/ul>\n\n\n\n<p>And the following are examples of mutable objects:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-list\/\">Lists<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-set\/\">Sets<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-dictionary\/\">Dictionaries<\/a><\/li>\n<\/ul>\n\n\n\n<p>User-defined classes can be mutable or immutable, depending on whether their internal state can be changed or not.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='python-immutable-example'>Python immutable example <a href=\"#python-immutable-example\" class=\"anchor\" id=\"python-immutable-example\" title=\"Anchor for Python immutable example\">#<\/a><\/h2>\n\n\n\n<p>When you <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-variables\/\">declare a variable<\/a> and assign its an integer, Python creates a new integer object and sets the variable to reference that object:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">counter = <span class=\"hljs-number\">100<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>To get the memory address referenced by a variable, you use the <code>id()<\/code> function. The <code>id()<\/code> function returns a based-10 number:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">print(id(counter))<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">140717671523072<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>And to convert the base-10 number to hexadecimal, you can use the <code>hex()<\/code> function:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">print(hex(id(<span class=\"hljs-number\">100<\/span>)))<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">0x7ffb62d32300<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In the memory, you have a variable called <code>counter<\/code> that references an integer object located at the <code>0x7ffb62d32300<\/code> address:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"414\" height=\"117\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Immutable-Example-1.png\" alt=\"Python Immutable Example\" class=\"wp-image-783\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Immutable-Example-1.png 414w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Immutable-Example-1-300x85.png 300w\" sizes=\"auto, (max-width: 414px) 100vw, 414px\" \/><\/figure>\n<\/div>\n\n\n<p>The following changes the <code>counter<\/code> to 200 and displays its value to the screen:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">counter = <span class=\"hljs-number\">200<\/span>\nprint(counter)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">200<\/span>   <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>It seems that the value of the object referenced by the <code>counter<\/code> variable changes, but it doesn&#8217;t. <\/p>\n\n\n\n<p>In fact, Python creates a new integer object with the value 200 and reassigns the <code>counter<\/code> variable so that it references the new object like this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"411\" height=\"237\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Immutable-Example-2.png\" alt=\"Python Immutable Example\" class=\"wp-image-784\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Immutable-Example-2.png 411w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Immutable-Example-2-300x173.png 300w\" sizes=\"auto, (max-width: 411px) 100vw, 411px\" \/><\/figure>\n<\/div>\n\n\n<p>The reassignment doesn&#8217;t change the value of the first integer object. It just reassigns the reference.<\/p>\n\n\n\n<p>The following shows the memory address of the new object referenced by the <code>counter<\/code> variable:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">counter = <span class=\"hljs-number\">200<\/span>\nprint(counter)\nprint(hex(id(counter)))<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-number\">0x7ffb62d32f80<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='python-mutable-example'>Python mutable example <a href=\"#python-mutable-example\" class=\"anchor\" id=\"python-mutable-example\" title=\"Anchor for Python mutable example\">#<\/a><\/h2>\n\n\n\n<p>The following defines a <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-list\/\">list<\/a> of numbers and displays the memory address of the list:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">ratings = &#91;<span class=\"hljs-number\">1<\/span>, <span class=\"hljs-number\">2<\/span>, <span class=\"hljs-number\">3<\/span>]\nprint(hex(id(ratings)))  <span class=\"hljs-comment\"># 0x1840f97a340<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Behind the scene, Python creates a new list object and sets the <code>ranks<\/code> variable to reference the list:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"402\" height=\"108\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Mutable-Example.png\" alt=\"\" class=\"wp-image-787\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Mutable-Example.png 402w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Mutable-Example-300x81.png 300w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/figure>\n\n\n\n<p>When you add a number to the list like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">ratings.append(<span class=\"hljs-number\">4<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Python directly changes the value of the list object:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"399\" height=\"104\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Mutable-Example-2.png\" alt=\"\" class=\"wp-image-788\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Mutable-Example-2.png 399w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-Mutable-Example-2-300x78.png 300w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/><\/figure>\n\n\n\n<p>And Python doesn&#8217;t create a new object like the previous immutable example. <\/p>\n\n\n\n<p>The following code shows the value and memory address of the list referenced by the <code>ratings<\/code> variable:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">print(ratings)  <span class=\"hljs-comment\"># &#91;1, 2, 3, 4]<\/span>\nprint(hex(id(ratings)))  <span class=\"hljs-comment\"># 0x1840f97a340<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The output indicates the memory address of the list is the same.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='python-mutable-and-immutable-example'>Python mutable and immutable example <a href=\"#python-mutable-and-immutable-example\" class=\"anchor\" id=\"python-mutable-and-immutable-example\" title=\"Anchor for Python mutable and immutable example\">#<\/a><\/h2>\n\n\n\n<p>It&#8217;s important to understand that immutable objects are not something frozen or absolutely constant.<\/p>\n\n\n\n<p>Let&#8217;s take a look at an example.<\/p>\n\n\n\n<p>The following defines a <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-tuples\/\">tuple<\/a> whose elements are the two lists:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">low = &#91;<span class=\"hljs-number\">1<\/span>, <span class=\"hljs-number\">2<\/span>, <span class=\"hljs-number\">3<\/span>]\nhigh = &#91;<span class=\"hljs-number\">4<\/span>, <span class=\"hljs-number\">5<\/span>]\n\nrankings = (low, high)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Since the <code>rankings<\/code> is a tuple, it&#8217;s immutable, you cannot add a new element to or remove an element from it:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"453\" height=\"280\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-mutable-immutable.png\" alt=\"Python Mutable and Immutable\" class=\"wp-image-796\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-mutable-immutable.png 453w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-mutable-immutable-300x185.png 300w\" sizes=\"auto, (max-width: 453px) 100vw, 453px\" \/><\/figure>\n\n\n\n<p>However, the <code>rankings<\/code> tuple contains two lists that are mutable objects. Therefore, you can add a new element to the <code>high<\/code> list without any issue:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">high.append(<span class=\"hljs-number\">6<\/span>)\nprint(rankings)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>And the <code>rankings<\/code> tuple changes to the following:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">(&#91;<span class=\"hljs-number\">1<\/span>, <span class=\"hljs-number\">2<\/span>, <span class=\"hljs-number\">3<\/span>], &#91;<span class=\"hljs-number\">4<\/span>, <span class=\"hljs-number\">5<\/span>, <span class=\"hljs-number\">6<\/span>])<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"455\" height=\"289\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-mutable-immutable-2.png\" alt=\"Python Mutable and Immutable\" class=\"wp-image-797\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-mutable-immutable-2.png 455w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/10\/Python-mutable-immutable-2-300x191.png 300w\" sizes=\"auto, (max-width: 455px) 100vw, 455px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An object whose internal state <strong>cannot be changed <\/strong>is called immutable for example a number, a string, and a tuple.<\/li>\n\n\n\n<li>An object whose internal state <strong>can be changed <\/strong>is called mutable for example a list, a set, and a dictionary.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"782\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-mutable-and-immutable\/\"\n\t\t\t\tdata-post-title=\"Python Mutable and Immutable\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"782\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-mutable-and-immutable\/\"\n\t\t\t\tdata-post-title=\"Python Mutable and Immutable\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summary: in this tutorial, you&#8217;ll learn about the mutable and immutable in Python. Introduction to mutable and immuable in Python # In Python, everything is an object. An object has its own internal state. Some objects allow you to change their internal state and others don&#8217;t. An object whose internal state can be changed is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":757,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-782","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/comments?post=782"}],"version-history":[{"count":1,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/782\/revisions"}],"predecessor-version":[{"id":7104,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/782\/revisions\/7104"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/757"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}