

{"id":5783,"date":"2018-01-09T11:33:56","date_gmt":"2018-01-09T06:03:56","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=5783"},"modified":"2026-04-20T16:33:48","modified_gmt":"2026-04-20T11:03:48","slug":"python-data-structures-tutorial","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/","title":{"rendered":"Python Data Structures &#8211; Lists, Tuples, Sets, Dictionaries"},"content":{"rendered":"<p>Earlier, we discussed Python Operators. Today, in this Python Data Structures Tutorial, we will talk about the different data structures that Python provides us with.<\/p>\n<p>These include Python lists, Python tuples, Python sets, and Python dictionaries with their syntax and examples.<\/p>\n<p>So, let\u2019s start with Python Data Structure.<\/p>\n<h3>What are Python Data Structures?<\/h3>\n<p>You can think of a data structure as a way of organising and storing data such that we can access and modify it efficiently.<\/p>\n<p>Earlier, we have seen primitive data types like integers, floats, Booleans, and strings. Now, we\u2019ll take a deeper look at the non-primitive Python data structures.<\/p>\n<p>Let\u2019s begin with our first Python Data Structures and lists.<\/p>\n<h3>What is a Python List?<\/h3>\n<p>A list in Python is a heterogeneous container for items. This would remind you of an array in C++, but since Python does not support arrays, we have Python Lists.<\/p>\n<h4>1. How to Declare a Python List?<\/h4>\n<p>To use a list, you must declare it first. Do this using square brackets and separate values with commas.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; languages=['C++','Python','Scratch']<\/pre>\n<p>You can put any kind of value in a list. This can be a string, a Tuple, a Boolean, or even a list itself.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1=[1,[2,3],(4,5),False,'No']<\/pre>\n<p>Note that here, we put different kinds of values in the list. Hence, a list is (or can be) heterogeneous.<\/p>\n<h4>2. How to Access a Python List?<\/h4>\n<p><strong>a. Accessing an entire list in Python<\/strong><\/p>\n<p>To access an entire list, all you need to do is to type its name in the shell.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[1, [2, 3], (4, 5), False, &#8216;No&#8217;]<\/div>\n<p><strong>b. Accessing a single item from the list<\/strong><\/p>\n<p>To get just one item from the list, you must use its index. However, remember that indexing begins at 0. Let\u2019s first take a look at the two kinds of indexing.<\/p>\n<ul>\n<li><strong>Positive Indexing<\/strong>&#8211; As you can guess, positive indexing begins at 0 for the leftmost\/first item, and then traverses right.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1[3]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">False<\/div>\n<ul>\n<li><strong>Negative Indexing<\/strong>&#8211; Contrary to positive indexing, negative indexing begins at -1 for the rightmost\/last item, and then traverses left. To get the same item from list1 by negative indexing, we use the index -2.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; type(list1[-2])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&lt;class &#8216;bool&#8217;&gt;<\/div>\n<p>It is also worth noting that the index can\u2019t be a float; it has to be an integer.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1[1.0]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#219&gt;&#8221;, line 1, in &lt;module&gt;list1[1.0]<\/p>\n<p>TypeError: list indices must be integers or slices, not floats<\/p>\n<\/div>\n<p>If you face any doubt in a Python list or Python Data Structure, please comment.<\/p>\n<h4>3. Slicing a List in Python<\/h4>\n<p>Sometimes, you may not want an entire list or a single item, but several items from it. Here, the slicing operator [:] comes into play.<\/p>\n<p>Suppose we want items second through fourth from list \u2018list1\u2019. We write the following code for this.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1[1:4]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[[2, 3], (4, 5), False]<\/div>\n<p>Here, we wanted the items from [2,3] to False. The indices for these boundary items are 1 and 3 respectively. But if the ending index is n, then it prints items till index n-1. Hence, we gave it an ending index of 4 here.<\/p>\n<p>We can use negative indexing in the slicing operator too. Let\u2019s see how.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1[:-2]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[1, [2, 3], (4, 5)]<\/div>\n<p>Here, -2 is the index for the tuple (4,5).<\/p>\n<h4>4. A list is mutable in Python<\/h4>\n<p>Mutability is the ability to be mutated, to be changed. A list is mutable, so it is possible to reassign and delete individual items as well.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; languages<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;C++&#8217;, &#8216;Python&#8217;, &#8216;Scratch&#8217;]<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; languages[2]='Java'\r\n&gt;&gt;&gt; languages<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;C++&#8217;, &#8216;Python&#8217;, &#8216;Java&#8217;]<\/div>\n<p>How to delete an item, we will see in section D.<\/p>\n<h4>5. How to Delete a Python List?<\/h4>\n<p>Like anything else in Python, it is possible to delete a list.<\/p>\n<p>To delete an entire list, use the del keyword with the name of the list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#225&gt;&#8221;, line 1, in &lt;module&gt;list1<\/p>\n<p>NameError: name &#8216;list1&#8217; is not defined<\/p>\n<\/div>\n<p>But to delete a single item or a slice, you need its index\/indices.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; del languages[2]\r\n&gt;&gt;&gt; languages<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;C++&#8217;, &#8216;Python&#8217;]<\/div>\n<p>Let\u2019s delete a slice now.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; del languages[1:]\r\n&gt;&gt;&gt; languages<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;C++&#8217;]<\/div>\n<h4>6. Reassigning a List in Python<\/h4>\n<p>You can either reassign a single item, a slice, or an entire list. Let\u2019s take a new list and then reassign on it.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1=[1,2,3,4,5,6,7,8]<\/pre>\n<p><strong>a. Reassigning a single item in the list<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1[0]=0\r\n&gt;&gt;&gt; list1<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[0, 2, 3, 4, 5, 6, 7, 8]<\/div>\n<p><strong>b. Reassigning a slice in List<\/strong><\/p>\n<p>Now let\u2019s attempt reassigning a slice.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1[1:3]=[9,10,11]\r\n&gt;&gt;&gt; list1<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[0, 9, 10, 11, 4, 5, 6, 7, 8]<\/div>\n<p><strong>c. Reassigning the entire list<\/strong><\/p>\n<p>Finally, let\u2019s reassign the entire list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list1=[0,0,0]\r\n&gt;&gt;&gt; list1<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[0, 0, 0]<\/div>\n<p>To get an even deeper look into lists, read our article on Python Lists.<\/p>\n<p>Any query yet on Python Data structures, Please Comment<\/p>\n<h3>Tuple in Python<\/h3>\n<p>This Python Data Structure is like a, like a list in Python, is a heterogeneous container for items.<\/p>\n<p>But the major difference between the two (tuple and list) is that a list is mutable, but a tuple is immutable.<\/p>\n<p>This means that while you can reassign or delete an entire tuple, you cannot do the same to a single item or a slice.<\/p>\n<p>To declare a tuple, we use parentheses.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors=('Red','Green','Blue')<\/pre>\n<h4>1. Tuple Packing in Python<\/h4>\n<p>Python Tuple packing is the term for packing a sequence of values into a tuple without using parentheses.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; mytuple=1,2,3,\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #Or it could have been mytuple=1,2,3\r\n&gt;&gt;&gt; mytuple<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">(1, 2, 3)<\/div>\n<h4>2. Tuple Unpacking in Python<\/h4>\n<p>The opposite of tuple packing, unpacking allots the values from a tuple into a sequence of variables.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a,b,c=mytuple\r\n&gt;&gt;&gt; print(a,b,c)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">1 2 3<\/div>\n<h4>3. Creating a tuple with a single item<\/h4>\n<p>Let\u2019s do this once again. Create a tuple and assign a 1 to it.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a=(1)<\/pre>\n<p>Now, let\u2019s call the type() function on it.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; type(a)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&lt;class &#8216;int&#8217;&gt;<\/div>\n<p>As you can see, this declared an integer, not a tuple.<\/p>\n<p>To get around this, you need to append a comma to the end of the first item 1. This tells the interpreter that it\u2019s a tuple.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a=(1,)\r\n&gt;&gt;&gt; type(a)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&lt;class &#8216;tuple&#8217;&gt;<\/div>\n<h4>4. Accessing, Reassigning, and Deleting Items in a Tuple<\/h4>\n<p>We can perform these operations on a tuple just like we can on a list. The only differences that exist are because a tuple is immutable, so you can\u2019t mess with a single item or a slice.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; del a[0]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#251&gt;&#8221;, line 1, in &lt;module&gt;del a[0]<\/p>\n<p>TypeError: &#8216;tuple&#8217; object doesn&#8217;t support item deletion<\/p>\n<\/div>\n<p>Even though this tuple has only one item, we couldn\u2019t delete it because we used its index to delete.<\/p>\n<h3>Python Set<\/h3>\n<p>This is one of the important Python Data Structures. A Python set is a slightly different concept from a list or a tuple. A set in Python is just like a mathematical set. It does not hold duplicate values and is unordered. However, it is not immutable, unlike a tuple.<\/p>\n<p>Let\u2019s first declare a set. Use curly braces for the same.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; myset={3,1,2}\r\n&gt;&gt;&gt; myset\r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">{1, 2, 3}<\/div>\n<p>As you can see, it rearranged the elements in ascending order.<\/p>\n<p>Since a set is unordered, there is no way we can use indexing to access or delete its elements. Then, to perform operations on it, Python provides us with a list of functions and methods like discard(), pop(), clear(), remove(), add(), and more. Functions like len() and max() also apply to sets.<\/p>\n<p>Any doubts yet in Python Data Structures? Please Comment.<\/p>\n<h3>Python Dictionaries<\/h3>\n<p>Finally, we will take a look at Python dictionaries. Think of a real-life dictionary. What is it used for? It holds word-meaning pairs. Likewise, a Python dictionary holds key-value pairs. However, you may not use an unhashable item as a key.<\/p>\n<p><strong>Characteristics of Python dictionaries:<\/strong><\/p>\n<ul>\n<li><strong>Key value pairs:<\/strong> The data in dictionaries is stored in pairs. They are written inside brackets {} and are separated by using &#8220;:&#8221;.<\/li>\n<li><strong>Fast:<\/strong> Dictionaries are used as it helps in searching, adding and removing data quickly.<\/li>\n<li><strong>Auto adjust:<\/strong> These dictionaries automatically adjust their size when the data is added or removed.<\/li>\n<li><strong>Unique keys:<\/strong> here, all the keys are different; if any key is repeated again it will be replaced automatically.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; mydict={1:2,2:4,3:6}\r\n&gt;&gt;&gt; mydict<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">{1: 2, 2: 4, 3: 6}<\/div>\n<p>To access pairs from a Python dictionary, we use their keys as indices. For example, let\u2019s try accessing the value 4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; mydict[2]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">4<\/div>\n<p>This was all about the Python Data Structures Tutorial.<\/p>\n<h3>Python Interview Questions on Data Structures<\/h3>\n<p>1. Is Python good for data structures?<\/p>\n<p>2. What are the different types of data structures in Python?<\/p>\n<p>3. What is Python Data Structure? Explain with an example.<\/p>\n<p>4. What is a set data structure in Python?<\/p>\n<p>5. What data structure is a Python list?<\/p>\n<h3>Conclusion<\/h3>\n<p>Python keeps data in four main built-in containers called lists, tuples, sets, and dictionaries. Each container has its own rules for order, change, and quick search. A list keeps items in the order you add them and lets you change any item. A tuple locks items so they stay safe and unchanged.<\/p>\n<p>A set throws away any repeat and helps you test membership at lightning speed. A dictionary stores pairs of key and value so you can look up a value from its key faster than flipping a page. Picking the right structure makes code shorter, faster, and easier to read.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier, we discussed Python Operators. Today, in this Python Data Structures Tutorial, we will talk about the different data structures that Python provides us with. These include Python lists, Python tuples, Python sets, and&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":35888,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[3470,3810,8342,10459,12781,14984],"class_list":["post-5783","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-data-structures-in-python","tag-dictionaries-in-python","tag-lists-in-python","tag-python-data-structures","tag-sets-in-pythons","tag-tuples-in-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Data Structures - Lists, Tuples, Sets, Dictionaries - DataFlair<\/title>\n<meta name=\"description\" content=\"Python Data Structures - Learn Python Lists, Python sets,Python tuple and Python dictionary with their examples &amp; syntax, how to delete, create, access list\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Data Structures - Lists, Tuples, Sets, Dictionaries - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Python Data Structures - Learn Python Lists, Python sets,Python tuple and Python dictionary with their examples &amp; syntax, how to delete, create, access list\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-09T06:03:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-20T11:03:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Data-Structures-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Data Structures - Lists, Tuples, Sets, Dictionaries - DataFlair","description":"Python Data Structures - Learn Python Lists, Python sets,Python tuple and Python dictionary with their examples & syntax, how to delete, create, access list","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:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Python Data Structures - Lists, Tuples, Sets, Dictionaries - DataFlair","og_description":"Python Data Structures - Learn Python Lists, Python sets,Python tuple and Python dictionary with their examples & syntax, how to delete, create, access list","og_url":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-01-09T06:03:56+00:00","article_modified_time":"2026-04-20T11:03:48+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Data-Structures-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python Data Structures &#8211; Lists, Tuples, Sets, Dictionaries","datePublished":"2018-01-09T06:03:56+00:00","dateModified":"2026-04-20T11:03:48+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/"},"wordCount":1470,"commentCount":14,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Data-Structures-1.jpg","keywords":["data structures in python","dictionaries in python","lists in python","python data structures","sets in pythons","Tuples in python"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/","url":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/","name":"Python Data Structures - Lists, Tuples, Sets, Dictionaries - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Data-Structures-1.jpg","datePublished":"2018-01-09T06:03:56+00:00","dateModified":"2026-04-20T11:03:48+00:00","description":"Python Data Structures - Learn Python Lists, Python sets,Python tuple and Python dictionary with their examples & syntax, how to delete, create, access list","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Data-Structures-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Python-Data-Structures-1.jpg","width":1200,"height":628,"caption":"Python Data Structures"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-data-structures-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Data Structures &#8211; Lists, Tuples, Sets, Dictionaries"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=5783"}],"version-history":[{"count":21,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5783\/revisions"}],"predecessor-version":[{"id":147729,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5783\/revisions\/147729"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/35888"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=5783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=5783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=5783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}