{"id":74939,"date":"2020-01-08T11:07:41","date_gmt":"2020-01-08T05:37:41","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=74939"},"modified":"2020-01-08T11:07:41","modified_gmt":"2020-01-08T05:37:41","slug":"python-tuples-vs-lists","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/","title":{"rendered":"Python Tuples vs Lists &#8211; The clash of Mutables and Immutables"},"content":{"rendered":"<p>In this Python tuples vs lists article, we are going to see the things that make <strong>tuples<\/strong> and <strong>lists<\/strong> similar and things that distinguish them from each other.<\/p>\n<p>Tuples and lists have a lot in common so one can easily get <strong>confused<\/strong> about what to use when.<\/p>\n<p>We will also learn some good practices and how you can <strong>effectively<\/strong> decide which one you should use in different situations.<a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/12\/python-tuples-vs-lists.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-75022 aligncenter\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/12\/python-tuples-vs-lists.jpg\" alt=\"python tuples vs lists\" width=\"802\" height=\"420\" \/><\/a><\/p>\n<h3>Python Tuples vs Lists<\/h3>\n<p>Now, we are going to see different <strong>parameters<\/strong> differentiating <strong>Python tuples<\/strong> and <strong>lists<\/strong>.<\/p>\n<h3>Syntax Differences<\/h3>\n<p>Let\u2019s start by a quick study of Tuples and lists <strong>syntax<\/strong> structures.<\/p>\n<h4>Python Tuples<\/h4>\n<p>Tuple is a <strong>collection<\/strong> of <strong>items<\/strong> and they are <strong>immutable<\/strong>. To create a tuple, we surround the items in <strong>parenthesis (<\/strong>).<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">tuple1 = (1,2,3,4)\ntuple2 = (1,2.5,\u201dHey\u201d, False )\nprint( type(tuple1) )<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">&lt;class \u2018tuple\u2019&gt;<\/div>\n<h4>Python Lists<\/h4>\n<p>Lists are a <strong>mutable collection<\/strong> of <strong>items<\/strong>. We use <strong>square brackets<\/strong> to surround the items<strong> []<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">list1 = [1,2,3,4]\nlist2 = [1, 5.5, \u201cHello\u201d, True]\nprint( type(list1) )<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">&lt;class \u2018list\u2019&gt;<\/div>\n<h4>Accessing, Indexing, Slicing<\/h4>\n<p>In most of the parts, tuples and lists are <strong>similar<\/strong> to each other. <strong>Indexing<\/strong> and <strong>slicing<\/strong> are the same in <strong>tuples<\/strong> as <strong>lists<\/strong>.<\/p>\n<p>Let\u2019s see a quick example.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">list1 = [1, 2, 4, 5, 8, 9]\ntuple1 = (1, 2, 4, 5, 8, 9)\nprint( list1[3] , tuple1[3] )\nprint( list1[1:3] , tuple1[1:3] )<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">5 5<br \/>\n[2, 4] (2, 4)<\/div>\n<h3>Mutability<\/h3>\n<p>This is the most important <strong>difference<\/strong> that distinguishes tuples from lists.<\/p>\n<p>Mutability means the <strong>ability to change<\/strong>. In the context of Python objects, a <strong>mutable object<\/strong> can be <strong>changed<\/strong> by <strong>adding<\/strong> or <strong>removing items<\/strong>.<\/p>\n<h4>Mutable List<\/h4>\n<p><strong>Lists<\/strong> are <strong>mutable<\/strong> in nature which means we can <strong>add<\/strong> or <strong>remove<\/strong> items from the list. Let\u2019s try <strong>changing<\/strong> and <strong>adding<\/strong> a <strong>new element<\/strong> in our list.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">list1 = [1, 2, 4, 4]\nlist1[2] = 3\nprint(list1)\nlist1.append(5)\nprint(list1)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">[1, 2, 3, 4]<br \/>\n[1, 2, 3, 4, 5]<\/div>\n<p>As you see, we can <strong>change<\/strong> and <strong>add new elements<\/strong> in the list without any problem. Now let\u2019s try <strong>removing<\/strong> the element at the <strong>second index<\/strong> from the list.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">list1.remove(2)\nprint(list1)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">[1, 3, 4, 5]<\/div>\n<p>Hence we see that lists are <strong>mutable<\/strong> creatures.<\/p>\n<h4>Immutable Tuple<\/h4>\n<p><strong>Tuples<\/strong> are <strong>immutable<\/strong> so we <strong>cannot change<\/strong>, <strong>add<\/strong> or <strong>remove<\/strong> any <strong>item<\/strong> once a tuple is <strong>created<\/strong>. Let\u2019s try changing a value in tuple.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">tuple1 = (1, 2, 3, 4)\ntuple1[2] = 3<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Traceback (most recent call last):<br \/>\n<span style=\"font-weight: 400\">\u00a0\u00a0<\/span>File &#8220;&lt;stdin&gt;&#8221;, line 2, in &lt;module&gt;<br \/>\nTypeError: &#8216;tuple&#8217; object does not support item assignment<\/div>\n<p>Tuples items cannot be changed however, we can <strong>reassign<\/strong> the <strong>entire tuple<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">tuple1 = (10, 30, 20, 40)\nprint( tuple1 )\ntuple1 = (99, 100, 101, 102)\nprint( tuple1 )<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">(10, 30, 20, 40)<br \/>\n(99, 100, 101, 102)<\/div>\n<p>Now the variable is <strong>reassigned<\/strong> to <strong>reference<\/strong> a <strong>different tuple<\/strong>.<\/p>\n<h3>Methods<\/h3>\n<p>There are differences in the available methods on lists and tuples. Some methods are common in both the data structures.<\/p>\n<p>Other methods like<strong> append()<\/strong>, <strong>insert()<\/strong>, <strong>pop()<\/strong>, <strong>remove()<\/strong>,<strong> reverse()<\/strong> and <strong>sort()<\/strong> are available in <strong>lists<\/strong> while <strong>tuples<\/strong> have less methods because of its nature of <strong>immutability<\/strong>.<\/p>\n<h4>Python List Methods<\/h4>\n<p>There are <strong>46<\/strong> available methods on <strong>lists<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">len(dir( list))\ndir( list )<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">46<br \/>\n[&#8216;__add__&#8217;, &#8216;__class__&#8217;, &#8216;__contains__&#8217;, &#8216;__delattr__&#8217;, &#8216;__delitem__&#8217;, &#8216;__dir__&#8217;, &#8216;__doc__&#8217;, &#8216;__eq__&#8217;, &#8216;__format__&#8217;, &#8216;__ge__&#8217;, &#8216;__getattribute__&#8217;, &#8216;__getitem__&#8217;, &#8216;__gt__&#8217;, &#8216;__hash__&#8217;, &#8216;__iadd__&#8217;, &#8216;__imul__&#8217;, &#8216;__init__&#8217;, &#8216;__init_subclass__&#8217;, &#8216;__iter__&#8217;, &#8216;__le__&#8217;, &#8216;__len__&#8217;, &#8216;__lt__&#8217;, &#8216;__mul__&#8217;, &#8216;__ne__&#8217;, &#8216;__new__&#8217;, &#8216;__reduce__&#8217;, &#8216;__reduce_ex__&#8217;, &#8216;__repr__&#8217;, &#8216;__reversed__&#8217;, &#8216;__rmul__&#8217;, &#8216;__setattr__&#8217;, &#8216;__setitem__&#8217;, &#8216;__sizeof__&#8217;, &#8216;__str__&#8217;, &#8216;__subclasshook__&#8217;, &#8216;append&#8217;, &#8216;clear&#8217;, &#8216;copy&#8217;, &#8216;count&#8217;, &#8216;extend&#8217;, &#8216;index&#8217;, &#8216;insert&#8217;, &#8216;pop&#8217;, &#8216;remove&#8217;, &#8216;reverse&#8217;, &#8216;sort&#8217;]<\/div>\n<h4>Python Tuple Methods<\/h4>\n<p>There are <strong>33<\/strong> available methods on <strong>tuples<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">len(dir( tuple))\nprint( dir( tuple ) )<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">33<br \/>\n[&#8216;__add__&#8217;, &#8216;__class__&#8217;, &#8216;__contains__&#8217;, &#8216;__delattr__&#8217;, &#8216;__dir__&#8217;, &#8216;__doc__&#8217;, &#8216;__eq__&#8217;, &#8216;__format__&#8217;, &#8216;__ge__&#8217;, &#8216;__getattribute__&#8217;, &#8216;__getitem__&#8217;, &#8216;__getnewargs__&#8217;, &#8216;__gt__&#8217;, &#8216;__hash__&#8217;, &#8216;__init__&#8217;, &#8216;__init_subclass__&#8217;, &#8216;__iter__&#8217;, &#8216;__le__&#8217;, &#8216;__len__&#8217;, &#8216;__lt__&#8217;, &#8216;__mul__&#8217;, &#8216;__ne__&#8217;, &#8216;__new__&#8217;, &#8216;__reduce__&#8217;, &#8216;__reduce_ex__&#8217;, &#8216;__repr__&#8217;, &#8216;__rmul__&#8217;, &#8216;__setattr__&#8217;, &#8216;__sizeof__&#8217;, &#8216;__str__&#8217;, &#8216;__subclasshook__&#8217;, &#8216;count&#8217;, &#8216;index&#8217;]<\/div>\n<h3>Functions<\/h3>\n<p>Most of the Python functions can be applied on both <strong>lists<\/strong> and <strong>tuples<\/strong>. These functions include <strong>len()<\/strong>, <strong>max()<\/strong>, <strong>min()<\/strong>, <strong>sum()<\/strong>, <strong>any()<\/strong>, <strong>all()<\/strong>, <strong>sorted()<\/strong>.<\/p>\n<p>Let\u2019s see some of those and you can check the rest by applying yourself.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">num_list = [3,8,6,4,10]\nnum_tuple = (3,8,6,4,10)\n\nprint( max(num_list), max(num_tuple) )\nprint( sum(num_list), sum(num_tuple) )\nprint( sorted(num_list), sorted(num_tuple) )<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">10 10<br \/>\n31 31<br \/>\n[3, 4, 6, 8, 10] [3, 4, 6, 8, 10]<\/div>\n<h3>Python Tuples vs Lists &#8211; When to Use What?<\/h3>\n<p>Now we know the similarities and differences between tuples and lists.<\/p>\n<p>You might be thinking about when should we use tuples and when to use lists.<\/p>\n<p><strong>1.<\/strong> Tuples are used where we <strong>don\u2019t<\/strong> need to <strong>change<\/strong>, <strong>add<\/strong> or <strong>remove<\/strong> any <strong>element<\/strong>. Using tuples also indicated developers that the <strong>value<\/strong> is <strong>not meant<\/strong> to <strong>change<\/strong>.<\/p>\n<p><strong>2.<\/strong> If you have to <strong>update<\/strong>, <strong>add<\/strong> or <strong>remove<\/strong> an <strong>element<\/strong> in a collection then <strong>lists<\/strong> should be used.<\/p>\n<p><strong>3.<\/strong> <strong>Tuples<\/strong> are <strong>faster<\/strong> than <strong>lists<\/strong> when <strong>iterating<\/strong> over the <strong>elements<\/strong>.<\/p>\n<p>So if you are defining a <strong>constant<\/strong> set of <strong>values<\/strong> that you need to just <strong>iterate<\/strong> to then <strong>tuples<\/strong> should be the <strong>better choice<\/strong> for you.<\/p>\n<p><strong>4.<\/strong> You can\u2019t <strong>create<\/strong> a <strong>dictionary<\/strong> with <strong>lists<\/strong> as <strong>keys<\/strong>.<\/p>\n<p>Take the following example &#8211;<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">{[\u201cJohn\u201d, \u201cDoe\u201d] : \u201cLondon\u201d}<\/pre>\n<p>Will result in error &#8211;<\/p>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Traceback (most recent call last):<br \/>\n<span style=\"font-weight: 400\">\u00a0\u00a0<\/span>File &#8220;&lt;stdin&gt;&#8221;, line 1, in &lt;module&gt;<br \/>\nTypeError: unhashable type: &#8216;list&#8217;<\/div>\n<p>You can use <strong>tuples<\/strong> for this <strong>without<\/strong> any <strong>problem<\/strong>.<\/p>\n<p>{(&#8220;John&#8221;, &#8220;Doe&#8221;) : &#8220;London&#8221;}<\/p>\n<p><strong>Tuples<\/strong> are also used as <strong>equivalent<\/strong> to the <strong>dictionary without keys<\/strong>.<\/p>\n<p>[(\u201cred\u201d, 1), (\u201cgreen\u201d, 2), (\u201cblue\u201d, 3)]<\/p>\n<h3>Summary<\/h3>\n<p>That was all about the Python tuples vs lists discussion.<\/p>\n<p>We saw the different <strong>syntax<\/strong> of <strong>tuples<\/strong> and <strong>lists<\/strong> and the <strong>mutability<\/strong> of these <strong>collections<\/strong> which is the <strong>major difference<\/strong> in them. We saw all the methods that are <strong>available<\/strong> for lists and tuples. In the end, we discussed how we can <strong>use<\/strong> <strong>tuples<\/strong> and <strong>lists<\/strong> <strong>effectively<\/strong> depending on <strong>different situations<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this Python tuples vs lists article, we are going to see the things that make tuples and lists similar and things that distinguish them from each other. Tuples and lists have a lot&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":75022,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1053],"tags":[1233,1234,1235,1183,1236,1237,1238],"class_list":["post-74939","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python-functions","tag-python-list-methods","tag-python-methods","tag-python-tuple-methods","tag-python-tuples-vs-lists","tag-tuples-and-lists-in-python","tag-tuples-vs-lists-in-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Tuples vs Lists - The clash of Mutables and Immutables - TechVidvan<\/title>\n<meta name=\"description\" content=\"Python tuples vs lists - Know the important differences between tuples and lists in Python on the basis of syntax, mutability, etc with their usage.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Tuples vs Lists - The clash of Mutables and Immutables - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Python tuples vs lists - Know the important differences between tuples and lists in Python on the basis of syntax, mutability, etc with their usage.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-08T05:37:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/12\/python-tuples-vs-lists.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Tuples vs Lists - The clash of Mutables and Immutables - TechVidvan","description":"Python tuples vs lists - Know the important differences between tuples and lists in Python on the basis of syntax, mutability, etc with their usage.","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:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/","og_locale":"en_US","og_type":"article","og_title":"Python Tuples vs Lists - The clash of Mutables and Immutables - TechVidvan","og_description":"Python tuples vs lists - Know the important differences between tuples and lists in Python on the basis of syntax, mutability, etc with their usage.","og_url":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-01-08T05:37:41+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/12\/python-tuples-vs-lists.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Python Tuples vs Lists &#8211; The clash of Mutables and Immutables","datePublished":"2020-01-08T05:37:41+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/"},"wordCount":815,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/12\/python-tuples-vs-lists.jpg","keywords":["python functions","python list methods","python methods","python tuple methods","python tuples vs lists","tuples and lists in python","tuples vs lists in Python"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/","url":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/","name":"Python Tuples vs Lists - The clash of Mutables and Immutables - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/12\/python-tuples-vs-lists.jpg","datePublished":"2020-01-08T05:37:41+00:00","description":"Python tuples vs lists - Know the important differences between tuples and lists in Python on the basis of syntax, mutability, etc with their usage.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/12\/python-tuples-vs-lists.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2019\/12\/python-tuples-vs-lists.jpg","width":802,"height":420,"caption":"python tuples vs lists"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/python-tuples-vs-lists\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Python Tuples vs Lists &#8211; The clash of Mutables and Immutables"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/74939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=74939"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/74939\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/75022"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=74939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=74939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=74939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}