

{"id":5420,"date":"2017-12-26T10:57:35","date_gmt":"2017-12-26T05:27:35","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=5420"},"modified":"2026-04-20T16:44:53","modified_gmt":"2026-04-20T11:14:53","slug":"python-list-examples","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-list-examples\/","title":{"rendered":"Python List with Examples &#8211; A Complete Python List Tutorial"},"content":{"rendered":"<p>In today\u2019s tutorial, we will learn about Python list. We will discuss how to create, access, slice, and reassign list in Python. Then we will see how to apply functions to them.\u00a0 Along with this, we will discuss\u00a0Python List Operations and\u00a0Concatenation.<\/p>\n<p>So, let&#8217;s start the Python List Tutorial.<\/p>\n<h3>What is Python List?<\/h3>\n<p>Unlike C++ or Java, Python Programming Language doesn\u2019t have arrays. To hold a sequence of values, then, it provides the \u2018list\u2019 class. A Python list can be seen as a collection of values.<\/p>\n<h4>1. How to Create Python List?<\/h4>\n<p>To create python list of items, you need to mention the items, separated by commas, in square brackets. This is the python syntax you need to follow. Then assign it to a variable. Remember once again, you don\u2019t need to declare the data type, because Python is dynamically-typed.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors=['red','green','blue']<\/pre>\n<p>A Python list may hold different types of values.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; days=['Monday','Tuesday','Wednesday',4,5,6,7.0]<\/pre>\n<p>A list may have python list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; languages=[['English'],['Gujarati'],['Hindi'],'Romanian','Spanish']\r\n&gt;&gt;&gt; languages<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[[&#8216;English&#8217;], [&#8216;Gujarati&#8217;], [&#8216;Hindi&#8217;], &#8216;Romanian&#8217;, &#8216;Spanish&#8217;]<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; type(languages[0])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&lt;class &#8216;list&#8217;&gt;<\/div>\n<p>A list may also contain tuples or so.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; languages=[('English','Albanian'),'Gujarati','Hindi','Romanian','Spanish']\r\n&gt;&gt;&gt; languages[0]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">(&#8216;English&#8217;, &#8216;Romanian&#8217;)<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; type(languages[0])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&lt;class &#8216;tuple&#8217;&gt;<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; languages[0][0]='Albanian'<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#24&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>languages[0][0]=&#8217;Albanian&#8217;<\/p>\n<p>TypeError: &#8216;tuple&#8217; object does not support item assignment<\/p>\n<\/div>\n<h4>2. How to Access a List in Python?<\/h4>\n<p>To access a Python list as a whole, all you need is its name.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; days<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>[&#8216;Monday&#8217;, &#8216;Tuesday&#8217;, &#8216;Wednesday&#8217;, 4, 5, 6, 7.0]<\/p>\n<\/div>\n<p>Or, you can put it in a print statement.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; languages=[['English'],['Gujarati'],['Hindi'],'Romanian','Spanish']\r\n&gt;&gt;&gt; print(languages)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[[&#8216;English&#8217;], [&#8216;Gujarati&#8217;], [&#8216;Hindi&#8217;], &#8216;Romanian&#8217;, &#8216;Spanish&#8217;]<\/div>\n<p>To access a single element, use its index in square brackets after the list\u2019s name. Indexing begins at 0.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; languages[0]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;English&#8217;]<\/div>\n<p>An index cannot be a float value.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; languages[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#70&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>languages[1.0]<\/p>\n<p>TypeError: list indices must be integers or slices, not float<\/p>\n<\/div>\n<h4>3. Slicing a Python List<\/h4>\n<p>When you want only a part of a Python list, you can use the slicing operator [].<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; indices=['zero','one','two','three','four','five']\r\n&gt;&gt;&gt; indices[2:4]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;two&#8217;, &#8216;three&#8217;]<\/div>\n<p>This returns items from index 2 to index 4-1 (i.e., 3)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; indices[:4]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;zero&#8217;, &#8216;one&#8217;, &#8216;two&#8217;, &#8216;three&#8217;]<\/div>\n<p>This returns items from the beginning of the list to index 3.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; indices[4:]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;four&#8217;, &#8216;five&#8217;]<\/div>\n<p>It returns items from index 4 to the end of the list in Python.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; indices[:]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;zero&#8217;, &#8216;one&#8217;, &#8216;two&#8217;, &#8216;three&#8217;, &#8216;four&#8217;, &#8216;five&#8217;]<\/div>\n<p>This returns the whole list.<\/p>\n<ul>\n<li><strong>Negative indices- <\/strong>The indices we mention can be negative as well. A negative index means traversal from the end of the list.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; indices[:-2]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;zero&#8217;, &#8216;one&#8217;, &#8216;two&#8217;, &#8216;three&#8217;]<\/div>\n<p>This returns item from the list\u2019s beginning to two items from the end.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; indices[1:-2]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;one&#8217;, &#8216;two&#8217;, &#8216;three&#8217;]<\/div>\n<p>It returns items from the item at index 1 to two items from the end.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; indices[-2:-1]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;four&#8217;]<\/div>\n<p>This returns items from two from the end to one from the end.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; indices[-1:-2]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[]<\/div>\n<p>This returns an empty Python\u00a0list, because the start is ahead of the stop for the traversal.<\/p>\n<h4>4. Reassigning a Python List (Mutable)<\/h4>\n<p>Python Lists are mutable. This means that you can reassign its items, or you can reassign it as a whole. Let\u2019s take a new list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors=['red','green','blue']<\/pre>\n<h4>a. Reassigning the whole Python list<\/h4>\n<p>You can reassign a Python list by assigning it like a new list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors=['caramel','gold','silver','occur']\r\n&gt;&gt;&gt; colors<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;caramel&#8217;, &#8216;gold&#8217;, &#8216;silver&#8217;, &#8216;occur&#8217;]<\/div>\n<h4>b. Reassigning a few elements<\/h4>\n<p>You can also reassign a slice of a list in Python.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors[2:]=['bronze','silver']\r\n&gt;&gt;&gt; colors<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;caramel&#8217;, &#8216;gold&#8217;, &#8216;bronze&#8217;, &#8216;silver&#8217;]<\/div>\n<p>If we had instead put two values to a single one in the left, see what would\u2019ve happened.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors=['caramel','gold','silver','occur']\r\n&gt;&gt;&gt; colors[2:3]=['bronze','silver']\r\n&gt;&gt;&gt; colors<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;caramel&#8217;, &#8216;gold&#8217;, &#8216;bronze&#8217;, &#8216;silver&#8217;, &#8216;occur&#8217;]<\/div>\n<p>colors[2:3] reassigns the element at index 2, which is the third element.<\/p>\n<p>2:2 works too.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors[2:2]=['occur']\r\n&gt;&gt;&gt; colors<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;caramel&#8217;, &#8216;gold&#8217;, &#8216;occur&#8217;, &#8216;bronze&#8217;, &#8216;silver&#8217;]<\/div>\n<h4>c. Reassigning a single element in a List<\/h4>\n<p>You can reassign individual elements too.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors=['caramel','gold','silver','occur']\r\n&gt;&gt;&gt; colors[3]='bronze'\r\n&gt;&gt;&gt; colors<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;caramel&#8217;, &#8216;gold&#8217;, &#8216;silver&#8217;, &#8216;bronze&#8217;]<\/div>\n<p>Now, if you want to add another item, \u2018holographic\u2019, to the list, we cannot do it the conventional way.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors[4]='holographic'<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#2&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>colors[4]=&#8217;holographic&#8217;<\/p>\n<p>IndexError: list assignment index out of range<\/p>\n<\/div>\n<p>So, you need to reassign the whole list for the same.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors=['caramel','gold','silver','bronze','holographic']\r\n&gt;&gt;&gt; colors<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;caramel&#8217;, &#8216;gold&#8217;, &#8216;silver&#8217;, &#8216;bronze&#8217;, &#8216;holographic&#8217;]<\/div>\n<h4>3. How can we delete a Python List?<\/h4>\n<p>You can delete a Python list, some of its elements, or a single element.<\/p>\n<h4>a. Deleting the entire Python list<\/h4>\n<p>Use the del keyword for the same.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; del colors\r\n&gt;&gt;&gt; colors<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#51&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>colors<\/p>\n<p>NameError: name &#8216;colors&#8217; is not defined<\/p>\n<\/div>\n<h4>b. Deleting a few elements in the List<\/h4>\n<p>Use the slicing operator in Python to delete a slice.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors=['caramel','gold','silver','bronze','holographic']\r\n&gt;&gt;&gt; del colors[2:4]\r\n&gt;&gt;&gt; colors<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;caramel&#8217;, &#8216;gold&#8217;, &#8216;holographic&#8217;]<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; colors[2]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&#8216;holographic&#8217;<\/div>\n<p>Now, \u2018holographic\u2019 is at position 2.<\/p>\n<h4>c. Deleting a single element in a List<\/h4>\n<p>To delete a single element from a Python list, use its index.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; del colors[0]\r\n&gt;&gt;&gt; colors<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;gold&#8217;, &#8216;holographic&#8217;]<\/div>\n<h3>Multidimensional Lists in Python<\/h3>\n<p><strong>Benefits of multidimensional Lists in Python:<\/strong><\/p>\n<ul>\n<li><strong>Easy data organization:<\/strong> Data is being stored in rows and columns, which makes it easy to understand and work with spreadsheets and matrices.<\/li>\n<li><strong>Variety of data:<\/strong> These lists can store a variety of values like numbers, decimals, and texts.<\/li>\n<li><strong>No extra installations needed:<\/strong> Multidimensional lists come as a built- in feature in Python, so it doesn&#8217;t require any extra installation.<\/li>\n<\/ul>\n<p>You can also put a list in a list. Let\u2019s look at a multidimensional list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; grocery_list=[['caramel','P&amp;B','Jelly'],['onions','potatoes'],['flour','oil']]\r\n&gt;&gt;&gt; grocery_list<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[[&#8216;caramel&#8217;, &#8216;P&amp;B&#8217;, &#8216;Jelly&#8217;], [&#8216;onions&#8217;, &#8216;potatoes&#8217;], [&#8216;flour&#8217;, &#8216;oil&#8217;]]<\/div>\n<p>This is a grocery Python list with lists in it, where the lists are according to a category.<\/p>\n<p>Or, you can choose to go deeper.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a=[[[1,2],[3,4],5],[6,7]]\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[[[1, 2], [3, 4], 5], [6, 7]]<\/div>\n<p>To access element 4 here, we type the following code into the shell.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a[0][1][1]<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">4<\/div>\n<h3>Concatenation of Python List<\/h3>\n<p>The concatenation operator works for lists as well. It lets us join two lists, with their orders preserved.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a,b=[3,1,2],[5,4,6]\r\n&gt;&gt;&gt; a+b<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[3, 1, 2, 5, 4, 6]<\/div>\n<h3>Python List Operations<\/h3>\n<h4>a. Multiplication Operation<\/h4>\n<p>This is an arithmetic operation. Multiplying a Python list by an integer makes copies of its items that a number of times while preserving the order.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a*=3\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[3, 1, 2, 3, 1, 2, 3, 1, 2]<\/div>\n<p>However, you can\u2019t multiply it by a float.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a*3.0<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#89&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>a*3.0<\/p>\n<p>TypeError: can&#8217;t multiply sequence by non-int of type &#8216;float&#8217;<\/p>\n<\/div>\n<h4>b. Membership Operation<\/h4>\n<p>You can apply the \u2018in\u2019 and \u2018not in\u2019 operators on a Python list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; 1 in a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">True<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; 2 not in a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">False<\/div>\n<h3>Iterating on a list in Python<\/h3>\n<p>Python list can be traversed with a for loop\u00a0in python.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; for i in [1,2,3]:\r\n         if i%2==0:\r\n                print(f\"{i} is composite\\n\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">2 is composite<\/div>\n<h3>Python List Comprehension<\/h3>\n<p>You can create a new list just like you would in mathematics. To do so, type an expression followed by a for statement, all inside square brackets. You may assign it to a variable. Let\u2019s make a list for all even numbers from 1 to 20.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; even=[2*i for i in range(1,11)]\r\n&gt;&gt;&gt; even<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]<\/div>\n<p>Optionally, you can add an if-statement to filter out items. If we want to change this list to hold only those items from 1 to 20 that are even and are divisible by 3, we write the following code.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; even=[2*i for i in range(1,11) if i%3==0]\r\n&gt;&gt;&gt; even<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[6, 12, 18]<\/div>\n<h3>Built-in List Functions<\/h3>\n<p>There are some built-in functions in Python that you can use on Python lists.<\/p>\n<div id=\"attachment_35693\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Built-in-List-Functions-in-Python-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-35693\" class=\"size-full wp-image-35693\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Built-in-List-Functions-in-Python-01.jpg\" alt=\"Python List Tutorial - Built-in List Functions\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Built-in-List-Functions-in-Python-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Built-in-List-Functions-in-Python-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Built-in-List-Functions-in-Python-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Built-in-List-Functions-in-Python-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Built-in-List-Functions-in-Python-01-1024x536.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Built-in-List-Functions-in-Python-01-520x272.jpg 520w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-35693\" class=\"wp-caption-text\">Python List Tutorial &#8211; Built-in List Functions<\/p><\/div>\n<h4>a. len() in python<\/h4>\n<p>It calculates the length of the list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; len(even)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">3<\/div>\n<h4>b. max() in python<\/h4>\n<p>It returns the item from the list with the highest value.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; max(even)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">18<\/div>\n<p>If all the items in your list are strings, it will compare.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; max(['1','2','3'])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">&#8216;3&#8217;<\/div>\n<p>But it fails when some are numeric, and some are strings in python.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; max([2,'1','2'])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#116&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>max([2,&#8217;1&#8242;,&#8217;2&#8242;])<\/p>\n<p>TypeError: &#8216;&gt;&#8217; not supported between instances of &#8216;str&#8217; and &#8216;int&#8217;<\/p>\n<\/div>\n<h4>c. min() in python<\/h4>\n<p>It returns the item from the Python list with the lowest value.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; min(even)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">6<\/div>\n<h4>d. sum() in python<\/h4>\n<p>It returns the sum of all the elements in the list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; sum(even)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">36<\/div>\n<p>However, for this, the\u00a0Python list must hold all numeric values.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a=['1','2','3']\r\n&gt;&gt;&gt; sum(a)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#112&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>sum(a)<\/p>\n<p>TypeError: unsupported operand type(s) for +: &#8216;int&#8217; and &#8216;str&#8217;<\/p>\n<\/div>\n<p>It works on floats.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; sum([1.1,2.2,3.3])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">6.6<\/div>\n<h4>e. sorted() in python<\/h4>\n<p>It returns a sorted version of the list, but does not change the original one.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a=[3,1,2]\r\n&gt;&gt;&gt; sorted(a)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[1, 2, 3]<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[3, 1, 2]<\/div>\n<p>If the\u00a0Python list members are strings, it sorts them according to their ASCII values.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; sorted(['hello','hell','Hello'])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;Hello&#8217;, &#8216;hell&#8217;, &#8216;hello&#8217;]<\/div>\n<p>Here, since H has an ASCII value of 72, it appears first.<\/p>\n<h4>f. list() in python<\/h4>\n<p>It converts a different data type into a list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list(\"abc\")<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[&#8216;a&#8217;, &#8216;b&#8217;, &#8216;c&#8217;]<\/div>\n<p>It can\u2019t convert a single int into a list, though, it only converts iterables.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; list(2)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>Traceback (most recent call last):File &#8220;&lt;pyshell#122&gt;&#8221;, line 1, in &lt;module&gt;<\/p>\n<p>list(2)<\/p>\n<p>TypeError: &#8216;int&#8217; object is not iterable<\/p>\n<\/div>\n<h4>g. any() in python<\/h4>\n<p>It returns True if even one item in the\u00a0Python list has a True value.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; any(['','','1'])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">True<\/div>\n<p>It returns False for an empty iterable.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; any([])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">False<\/div>\n<h4>h. all() in python<\/h4>\n<p>It returns True if all items in the list have a True value.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; all(['','','1'])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">False<\/div>\n<p>It returns True for an empty iterable.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; all([])<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">True<\/div>\n<h3>Built-in Methods<\/h3>\n<p>While a function is what you can apply on a construct and get a result, a method is what you can do to it and change it. To call a method on a construct, you use the dot-operator(.). Python supports some built-in methods to alter a\u00a0Python list.<\/p>\n<div id=\"attachment_35746\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-List-Built-in-Methods-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-35746\" class=\"size-full wp-image-35746\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-List-Built-in-Methods-01.jpg\" alt=\"Python List - Built-in Methods\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-List-Built-in-Methods-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-List-Built-in-Methods-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-List-Built-in-Methods-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-List-Built-in-Methods-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-List-Built-in-Methods-01-1024x536.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-List-Built-in-Methods-01-520x272.jpg 520w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-35746\" class=\"wp-caption-text\">Python List &#8211; Built-in Methods<\/p><\/div>\n<h4>a. append() in python<\/h4>\n<p>It adds an item to the end of the list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[2, 1, 3]<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a.append(4)\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[2, 1, 3, 4]<\/div>\n<h4>b. insert() in python<\/h4>\n<p>It inserts an item at a specified position.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a.insert(3,5)\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[2, 1, 3, 5, 4]<\/div>\n<p>This inserted the element 5 at index 3.<\/p>\n<h4>c. remove() in python<\/h4>\n<p>It removes the first instance of an item from the\u00a0Python list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a=[2,1,3,5,2,4]\r\n&gt;&gt;&gt; a.remove(2)\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[1, 3, 5, 2, 4]<\/div>\n<p>Notice how there were two 2s, but it removed only the first one.<\/p>\n<h4>d. pop() in python<\/h4>\n<p>It removes the element at the specified index and prints it to the screen.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a.pop(3)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">2<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[1, 3, 5, 4]<\/div>\n<h4>e. clear() in python<\/h4>\n<p>It empties the\u00a0Python list.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a.clear()\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[]<\/div>\n<p>It now has a False value.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; bool(a)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">False<\/div>\n<h4>f. index() in python<\/h4>\n<p>It returns the first matching index of the item specified.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a=[1,3,5,3,4]\r\n&gt;&gt;&gt; a.index(3)\r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">1<\/div>\n<h4>g. count() in python<\/h4>\n<p>It returns the count of the item specified.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a.count(3)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">2<\/div>\n<h4>h. sort() in python<\/h4>\n<p>It sorts the list in ascending order.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a.sort()\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[1, 3, 3, 4, 5]<\/div>\n<h4>i. reverse() in python<\/h4>\n<p>It reverses the order of elements in the\u00a0Python lists.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; a.reverse()\r\n&gt;&gt;&gt; a<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">[5, 4, 3, 3, 1]<\/div>\n<p>This was all about the Python lists<\/p>\n<h3>Python Interview Questions on Lists<\/h3>\n<p>1. What are lists in Python? Explain with an example.<\/p>\n<p>2. How to get the elements of a list in Python?<\/p>\n<p>3. How to make a list in Python?<\/p>\n<p>4. What are lists used for in Python?<\/p>\n<p>5. What are lists called in Python?<\/p>\n<h3>Conclusion<\/h3>\n<p>A Python list is like a row of labeled boxes that keep the exact order you place them in. You can drop in numbers that track your sales, words that build a sentence, or even other lists that hold a full table. Because a list is mutable, you can pop out an item, insert a new one, or shuffle their places with a single call.<\/p>\n<p>Slice notation lets you copy or edit a chosen stretch without touching the rest, while list methods such as append, extend, sort, and reverse supply common tasks for free.<\/p>\n<p>Furthermore, if you have any queries, feel free to ask in the comment section<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In today\u2019s tutorial, we will learn about Python list. We will discuss how to create, access, slice, and reassign list in Python. Then we will see how to apply functions to them.\u00a0 Along with&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":42165,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[8322,8342,10645,10646,10647,10649],"class_list":["post-5420","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-list-functions-in-python","tag-lists-in-python","tag-python-list-function","tag-python-list-of-lists","tag-python-list-slice","tag-python-lists"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python List with Examples - A Complete Python List Tutorial - DataFlair<\/title>\n<meta name=\"description\" content=\"Python list Tutorial,how to create lists in python, Python lists functions and concatenation, Python list slicing, delete,reassign,Python List Operations\" \/>\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-list-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python List with Examples - A Complete Python List Tutorial - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Python list Tutorial,how to create lists in python, Python lists functions and concatenation, Python list slicing, delete,reassign,Python List Operations\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-list-examples\/\" \/>\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=\"2017-12-26T05:27:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-20T11:14:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Lists-2.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=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python List with Examples - A Complete Python List Tutorial - DataFlair","description":"Python list Tutorial,how to create lists in python, Python lists functions and concatenation, Python list slicing, delete,reassign,Python List Operations","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-list-examples\/","og_locale":"en_US","og_type":"article","og_title":"Python List with Examples - A Complete Python List Tutorial - DataFlair","og_description":"Python list Tutorial,how to create lists in python, Python lists functions and concatenation, Python list slicing, delete,reassign,Python List Operations","og_url":"https:\/\/data-flair.training\/blogs\/python-list-examples\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2017-12-26T05:27:35+00:00","article_modified_time":"2026-04-20T11:14:53+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Lists-2.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":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-list-examples\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-list-examples\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python List with Examples &#8211; A Complete Python List Tutorial","datePublished":"2017-12-26T05:27:35+00:00","dateModified":"2026-04-20T11:14:53+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-list-examples\/"},"wordCount":1873,"commentCount":20,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-list-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Lists-2.jpg","keywords":["list functions in python","lists in python","python list function","python list of lists","python list slice","python lists"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-list-examples\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-list-examples\/","url":"https:\/\/data-flair.training\/blogs\/python-list-examples\/","name":"Python List with Examples - A Complete Python List Tutorial - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-list-examples\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-list-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Lists-2.jpg","datePublished":"2017-12-26T05:27:35+00:00","dateModified":"2026-04-20T11:14:53+00:00","description":"Python list Tutorial,how to create lists in python, Python lists functions and concatenation, Python list slicing, delete,reassign,Python List Operations","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-list-examples\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-list-examples\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-list-examples\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Lists-2.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Python-Lists-2.jpg","width":1200,"height":628,"caption":"Python List with Examples - A Complete Python List Tutorial"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-list-examples\/#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 List with Examples &#8211; A Complete Python List Tutorial"}]},{"@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\/5420","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=5420"}],"version-history":[{"count":23,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5420\/revisions"}],"predecessor-version":[{"id":147733,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/5420\/revisions\/147733"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/42165"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=5420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=5420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=5420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}