{"id":18269,"date":"2021-08-20T12:56:06","date_gmt":"2021-08-20T07:26:06","guid":{"rendered":"https:\/\/tutorial.eyehunts.com\/?p=18269"},"modified":"2021-08-20T12:56:09","modified_gmt":"2021-08-20T07:26:09","slug":"python-find-duplicates-in-list-of-lists-example-code","status":"publish","type":"post","link":"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/","title":{"rendered":"Python find duplicates in list of lists | Example code"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><strong>Python find duplicates in the list of lists Example<\/strong><\/h3>\n\n\n\n<p>Given a list of lists, check there are if there are any duplicates in lists of lists that have the same values and order.<\/p>\n\n\n\n<p>Count the occurrences in a list <a href=\"https:\/\/tutorial.eyehunts.com\/python\/tuple-comprehension-python-example-code\/\">comprehension<\/a>, converting them to a <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-print-tuple-values-example-code\/\">tuple <\/a>so you can hash &amp; apply unicity:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>routes = &#91;&#91;1, 2, 4, 6, 10], &#91;1, 3, 8, 9, 10], &#91;1, 2, 4, 6, 10]]\r\ndups = {tuple(x) for x in routes if routes.count(x) > 1}\r\n\r\nprint(dups)<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"267\" height=\"116\" src=\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-find-duplicates-in-list-of-lists.jpg?resize=267%2C116&#038;ssl=1\" alt=\"Python find duplicates in list of lists\" class=\"wp-image-18292\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Simple enough, but a lot of looping under the hood because of repeated calls to <code>count<\/code>. There&#8217;s another way, which involves hashing but has a lower complexity would be to use <code>collections.Counter<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from collections import Counter\r\n\r\nroutes = &#91;&#91;1, 2, 4, 6, 10], &#91;1, 3, 8, 9, 10], &#91;1, 2, 4, 6, 10]]\r\n\r\nc = Counter(map(tuple,routes))\r\ndups = &#91;k for k,v in c.items() if v>1]\r\n\r\nprint(dups)<\/code><\/pre>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Find duplicate elements in a list of lists<\/strong><\/h3>\n\n\n\n<p>If there is a duplicate element that is common between any or all the lists, return True. If all of the elements are unique, return False.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def find_dup(l):\r\n    dupes = &#91;]\r\n    flat = &#91;item for sublist in l for item in sublist]\r\n    for f in flat:\r\n        if flat.count(f) > 1:\r\n            if f not in dupes:\r\n                dupes.append(f)\r\n\r\n    if dupes:\r\n        return True\r\n    else:\r\n        return False\r\n\r\n\r\nl = &#91;&#91;20, 21, 22], &#91;17, 18, 19, 20], &#91;10, 11, 12, 13]]\r\nprint(find_dup(l))\r\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: True<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Finding duplicates in a list of lists and merger them<\/strong><\/h3>\n\n\n\n<p>For example, de-duplicate a list of lists and merge the values of the duplicates.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>original_list = &#91;&#91;'a', 1], &#91;'b', 1], &#91;'a', 1], &#91;'b', 1], &#91;'b', 2], &#91;'c', 2], &#91;'b', 3]]\r\n\r\ntotals = {}\r\nfor k, v in original_list:\r\n    totals&#91;k] = totals.get(k, 0) + v\r\n\r\nprint(totals)<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<p>{&#8216;a&#8217;: 2, &#8216;b&#8217;: 7, &#8216;c&#8217;: 2}<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Source: stackoverflow.com<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Do comment if you have any doubts and suggestions on this Python List topic.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong> IDE:&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.jetbrains.com\/pycharm\/\" target=\"_blank\">PyCharm<\/a>&nbsp;2021.3.3 (Community Edition)<\/p><p>Windows 10<\/p><p><strong>Python 3.10.1<\/strong><\/p><p>All<strong>&nbsp;Python Examples&nbsp;are in&nbsp;Python&nbsp;3<\/strong>, so Maybe its different from python 2 or upgraded versions.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Python find duplicates in the list of lists Example Given a list of lists, check there are if there are any duplicates in lists of lists that have the same values and order. Count the occurrences in a list comprehension, converting them to a tuple so you can hash &amp; apply unicity: Output: Simple enough,&hellip;&nbsp;<a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Python find duplicates in list of lists | Example code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[30],"tags":[83],"post_series":[],"class_list":["post-18269","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-list"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python find duplicates in list of lists | Example code<\/title>\n<meta name=\"description\" content=\"f there is a duplicate element that is common between any or all the lists, return True. If all of the elements are unique, return False.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python find duplicates in list of lists | Example code\" \/>\n<meta property=\"og:description\" content=\"f there is a duplicate element that is common between any or all the lists, return True. If all of the elements are unique, return False.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-20T07:26:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-20T07:26:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-find-duplicates-in-list-of-lists.jpg\" \/>\n<meta name=\"author\" content=\"Rohit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rohit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/\",\"name\":\"Python find duplicates in list of lists | Example code\",\"isPartOf\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-find-duplicates-in-list-of-lists.jpg\",\"datePublished\":\"2021-08-20T07:26:06+00:00\",\"dateModified\":\"2021-08-20T07:26:09+00:00\",\"author\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\"},\"description\":\"f there is a duplicate element that is common between any or all the lists, return True. If all of the elements are unique, return False.\",\"breadcrumb\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-find-duplicates-in-list-of-lists.jpg?fit=267%2C116&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-find-duplicates-in-list-of-lists.jpg?fit=267%2C116&ssl=1\",\"width\":267,\"height\":116},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tutorial.eyehunts.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python find duplicates in list of lists | Example code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\",\"url\":\"https:\/\/tutorial.eyehunts.com\/\",\"name\":\"Tutorial\",\"description\":\"By EyeHunts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\",\"name\":\"Rohit\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"contentUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"caption\":\"Rohit\"},\"description\":\"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.\",\"url\":\"https:\/\/tutorial.eyehunts.com\/author\/rohit\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python find duplicates in list of lists | Example code","description":"f there is a duplicate element that is common between any or all the lists, return True. If all of the elements are unique, return False.","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:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/","og_locale":"en_US","og_type":"article","og_title":"Python find duplicates in list of lists | Example code","og_description":"f there is a duplicate element that is common between any or all the lists, return True. If all of the elements are unique, return False.","og_url":"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/","og_site_name":"Tutorial","article_published_time":"2021-08-20T07:26:06+00:00","article_modified_time":"2021-08-20T07:26:09+00:00","og_image":[{"url":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-find-duplicates-in-list-of-lists.jpg","type":"","width":"","height":""}],"author":"Rohit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rohit","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/","url":"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/","name":"Python find duplicates in list of lists | Example code","isPartOf":{"@id":"https:\/\/tutorial.eyehunts.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/#primaryimage"},"image":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/#primaryimage"},"thumbnailUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-find-duplicates-in-list-of-lists.jpg","datePublished":"2021-08-20T07:26:06+00:00","dateModified":"2021-08-20T07:26:09+00:00","author":{"@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1"},"description":"f there is a duplicate element that is common between any or all the lists, return True. If all of the elements are unique, return False.","breadcrumb":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/#primaryimage","url":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-find-duplicates-in-list-of-lists.jpg?fit=267%2C116&ssl=1","contentUrl":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-find-duplicates-in-list-of-lists.jpg?fit=267%2C116&ssl=1","width":267,"height":116},{"@type":"BreadcrumbList","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-find-duplicates-in-list-of-lists-example-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tutorial.eyehunts.com\/"},{"@type":"ListItem","position":2,"name":"Python find duplicates in list of lists | Example code"}]},{"@type":"WebSite","@id":"https:\/\/tutorial.eyehunts.com\/#website","url":"https:\/\/tutorial.eyehunts.com\/","name":"Tutorial","description":"By EyeHunts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1","name":"Rohit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/","url":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","contentUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","caption":"Rohit"},"description":"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.","url":"https:\/\/tutorial.eyehunts.com\/author\/rohit\/"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":18267,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-remove-duplicates-from-list-of-lists-example-code\/","url_meta":{"origin":18269,"position":0},"title":"Python remove duplicates from list of lists | Example code","author":"Rohit","date":"August 20, 2021","format":false,"excerpt":"Use the itertools to remove duplicates from a list of lists in Python. The itertools often offers the fastest and most powerful solutions to this kind of problem. Example remove duplicates from the lists of list in Python Simple example code. Before removing duplicates from a list you have to\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python remove duplicates from list of lists","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-remove-duplicates-from-list-of-lists.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":18197,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-merge-two-lists-without-duplicates-example-code\/","url_meta":{"origin":18269,"position":1},"title":"Python merge two lists without duplicates | Example code","author":"Rohit","date":"August 19, 2021","format":false,"excerpt":"Python merges two lists without duplicates could be accomplished by using a set. And use the + operator to merge it. list(set(list1 + list2)) Python merge list without duplicates example Simple example code using set with + operator. a = ['hello', 'world'] b = ['hello', 'universe'] unique = list(set(a +\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python merge two lists without duplicates","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-merge-two-lists-without-duplicates.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":34114,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-count-occurrences-in-list-of-lists\/","url_meta":{"origin":18269,"position":2},"title":"Python count occurrences in list of lists","author":"Rohit","date":"November 16, 2022","format":false,"excerpt":"Just use Counter from collections to count occurrences in the list of lists in Python. You have to convert to tuple because list is an unhashable type. Python count occurrences in the list of lists Simple example code loop through a set of your list and print each item with\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python count occurrences in the list of lists","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2022\/11\/Python-count-occurrences-in-the-list-of-lists.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":20919,"url":"https:\/\/tutorial.eyehunts.com\/python\/what-is-a-tuple-in-python-basics\/","url_meta":{"origin":18269,"position":3},"title":"What is a tuple in Python | Basics","author":"Rohit","date":"November 30, 2021","format":false,"excerpt":"Tuples are store multiple items in a single variable in Python. A tuple is an immutable object meaning that we cannot change, add or remove items after the tuple has been created. empty_tuple = () mytuple = (\"apple\", \"banana\", \"cherry\") Python Tuples are used to store collections of data, and\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"What is a tuple in Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/11\/What-is-a-tuple-in-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":20669,"url":"https:\/\/tutorial.eyehunts.com\/python\/difference-between-list-and-tuple-in-python-basics\/","url_meta":{"origin":18269,"position":4},"title":"Difference between list and tuple in Python | Basics","author":"Rohit","date":"November 30, 2021","format":false,"excerpt":"The difference between a list and a tuple is list is dynamic, whereas a tuple has static characteristics in Python. Lists are a useful tool for preserving a sequence of data and further iterating over it and the tuple is faster than the list because of static in nature. List\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2023\/06\/difference-between-list-and-tuple-in-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":40490,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-array-vs-list-vs-tuple\/","url_meta":{"origin":18269,"position":5},"title":"Python array vs list vs tuple","author":"Rohit","date":"July 4, 2023","format":false,"excerpt":"In Python, the terms \"array,\" \"list,\" and \"tuple\" refer to different types of data structures, each with its own characteristics and use cases. Let's Understand the differences between these data structures in Python. Here's the syntax for creating arrays, lists, and tuples in Python: Array (using NumPy): import numpy as\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2023\/07\/Python-array-vs-list-vs-tuple.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/18269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/comments?post=18269"}],"version-history":[{"count":1,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/18269\/revisions"}],"predecessor-version":[{"id":18295,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/18269\/revisions\/18295"}],"wp:attachment":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/media?parent=18269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/categories?post=18269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/tags?post=18269"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/post_series?post=18269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}