{"id":21121,"date":"2022-12-15T05:57:00","date_gmt":"2022-12-15T04:57:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=21121"},"modified":"2023-01-12T18:21:21","modified_gmt":"2023-01-12T17:21:21","slug":"python-lists","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/python\/python-lists\/","title":{"rendered":"Python lists"},"content":{"rendered":"\n<h4 class=\"has-text-align-center wp-block-heading\"><strong><em>Tutorial on Python lists and how to create, append, modify, index, insert or delete elements with scripts examples.<\/em><\/strong><\/h4>\n\n\n\n<p>Lists are a fundamental data structure in Python and understanding how to use them effectively is crucial for any Python developer. This tutorial covers the basics of lists, including creating and manipulating them, using list methods and comprehension, and working with multidimensional lists. Code examples and best practices are provided throughout the tutorial to help in understanding and implementing the concepts discussed.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#1-introduction-to-python-lists\" >1. Introduction to Python lists<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#2-lists-indexing-and-slicing\" >2. Lists indexing and slicing<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#21-index-lists-in-python\" >2.1 Index lists in Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#22-slice-a-list-in-python\" >2.2 Slice a list in Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#23-negative-indice-in-python\" >2.3 Negative indice in Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#24-slice-a-list-with-an-offset\" >2.4 Slice a list with an offset<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#3-lists-methods-in-python\" >3. Lists methods in Python<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#31-python-append-method\" >3.1 Python append method<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#32-extend-method-in-python\" >3.2 Extend method in Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#33-python-insert-method\" >3.3 Python insert method<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#34-python-remove-method\" >3.4 Python remove method<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#35-python-lists-pop-method\" >3.5 Python lists pop method<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#36-python-lists-index-method\" >3.6 Python lists index method<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#37-python-lists-count-method\" >3.7 Python lists count method<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#4-list-comprehension\" >4. List comprehension<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#5-multidimensional-lists-in-python\" >5. Multidimensional lists in Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/#6-conclusion-on-using-the-python-lists\" >6. Conclusion on using the Python lists<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-introduction-to-python-lists\"><span class=\"ez-toc-section\" id=\"1-introduction-to-python-lists\"><\/span>1. Introduction to Python lists<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python lists are a powerful and versatile data structure that allows you to store and manipulate a collection of items. They are enclosed in square brackets [] and can contain elements of any data type, such as numbers, strings, and even other lists. <strong><em>Lists in Python are mutable<\/em><\/strong>, meaning that you can add, remove, and change elements within the list.<\/p>\n\n\n\n<p><strong><em>Python lists are also ordered<\/em><\/strong>, so each element has a specific position within the list. Understanding how to work with lists in Python is an essential skill for any programmer, as they are commonly used in a wide range of applications. Below a script example to create 4 different types of lists: <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Numbers<\/li>\n\n\n\n<li>Strings<\/li>\n\n\n\n<li>A mixed list<\/li>\n\n\n\n<li>A list of lists<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">numbers = [1, 2, 3, 4, 5]\n\nwords = ['Hello', 'World']\n\nmixed = [1, 'Hello', 3.14]\n\n# a list of lists\nlists = [[1, 2, 3], [4, 5, 6]]  \n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-lists-indexing-and-slicing\"><span class=\"ez-toc-section\" id=\"2-lists-indexing-and-slicing\"><\/span>2. Lists indexing and slicing<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Just like <a href=\"https:\/\/expert-only.com\/en\/python\/python-strings\/\">Python strings<\/a>, lists can be indexed and sliced, allowing you to access individual items or sublists.<\/p>\n\n\n\n<p>List indexing and slicing is a powerful feature in Python that allows you to access individual items or sublists within a list.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"21-index-lists-in-python\"><\/span>2.1 Index lists in Python<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The basic syntax for indexing a list is to use square brackets [] and the index of the item you want to access. For example, to access the first item of a list called <em>my_list<\/em>, use the following code.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">my_list = [1, 2, 3, 4]\nfirst_item = my_list[0]\nprint(first_item)\n\n# the output is :[1]\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"22-slice-a-list-in-python\"><\/span>2.2 Slice a list in Python<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Slicing a list is like indexing, but instead of accessing a single item, you can access multiple items by specifying a range. The basic syntax for slicing a list is to use square brackets [] with a colon : between two indices. The first index is the starting position, and the second index is the ending position. Let&#8217;s say we want to access the items from the first to the third in a list called <strong><em>my_list<\/em><\/strong>, use the script below.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">my_list = [1, 2, 3, 4]\nsub_list = my_list[0:3]\nprint(sub_list)\n\n# \n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"23-negative-indice-in-python\"><\/span>2.3 Negative indice in Python<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>It&#8217;s also possible to use negative indices in list indexing and slicing. A negative index refers to an item counting from the end of the list. To access the last item of the list, use the specific script below.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">my_list = [1, 2, 3, 4]\nlast_item = my_list[-1]\nprint(last_item)\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"24-slice-a-list-with-an-offset\"><\/span>2.4 Slice a list with an offset<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In addition, it&#8217;s also possible to <em><strong>slice a list with an offset<\/strong><\/em> different from 1 (also called step value). For example, if we want to access every other item in a list, we can use the following code. Indeed, the Python script only displays one value from the list every two.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">my_list = [1, 2, 3, 4, 5, 6, 7]\nevery_other_item = my_list[0:7:2]\nprint(every_other_item)\n\n# displays : [1,3,5,7]\n<\/pre>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"iHicVNgae6\"><a href=\"https:\/\/expert-only.com\/en\/python\/python-strings\/\">Python Strings<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Python Strings&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/python\/python-strings\/embed\/#?secret=SSuZJ6GeuY#?secret=iHicVNgae6\" data-secret=\"iHicVNgae6\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-lists-methods-in-python\"><span class=\"ez-toc-section\" id=\"3-lists-methods-in-python\"><\/span>3. Lists methods in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python provides several built-in methods to work with lists, including methods for adding, removing, and modifying elements. These methods allow you to easily manipulate and organize your data in a list. Some commonly used Python methods to manage lits are the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Append<\/strong>: Adds an item to the end of the list.<\/li>\n\n\n\n<li><strong>Extend<\/strong>: Adds multiple items to the end of the list.<\/li>\n\n\n\n<li><strong>Insert<\/strong>: Inserts an item at a specific position in the list.<\/li>\n\n\n\n<li><strong>Remove<\/strong>: removes the first occurrence of an item from the list.<\/li>\n\n\n\n<li><strong>Pop<\/strong>: removes the last item from the list and returns it.<\/li>\n\n\n\n<li><strong>Index<\/strong>: returns the index of the first occurrence of an item in the list.<\/li>\n\n\n\n<li><strong>Count<\/strong>: returns the number of occurrences of an item in the list.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-1-python-append-method\"><span class=\"ez-toc-section\" id=\"31-python-append-method\"><\/span>3.1 Python append method<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The Python &#8220;append&#8221; method is a built-in function that allows you to add an item to the end of a list. And the basic syntax for the append method is illustrated in the 3 scripts below<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>The first example<\/em> adds the number 4 to the list.<\/li>\n\n\n\n<li>In <em>the second example<\/em>, if we have a list called &#8220;numbers&#8221; and we want to add the numbers 4 and 5 to the end of the list, we would use the following script.<\/li>\n\n\n\n<li>In <em>the third example<\/em>, let&#8217;s say we have a list of fruits called &#8220;fruits&#8221; and we want to add &#8220;mango&#8221; to the end of the list, we would use the few lines of code below.<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># add one item at a time\nmy_list = [1, 2, 3]\nmy_list.append(4)\nprint(my_list )\n\n# add multiple items at a time\nnumbers = [1, 2, 3]\nnumbers.append(4)\nprint(numbers)\n\nfruits = [\"apple\", \"banana\", \"orange\"]\nfruits.append(\"mango\")\nprint(fruits)\n<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"680\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/01\/python-lists-append-values-to-a-list.jpg\" alt=\"Add values to Python lists using the append method.\" class=\"wp-image-21401\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/01\/python-lists-append-values-to-a-list.jpg 720w, https:\/\/expert-only.com\/wp-content\/uploads\/2023\/01\/python-lists-append-values-to-a-list-300x283.jpg 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><figcaption class=\"wp-element-caption\"><strong>Add values to Python lists using the append method.<\/strong><\/figcaption><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-2-extend-method-in-python\"><span class=\"ez-toc-section\" id=\"32-extend-method-in-python\"><\/span>3.2 Extend method in Python<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The <code>extend()<\/code> method use with Python lists allows you to add multiple elements to a list. It takes an object than support iterations, such as a list or a tuple, as an argument and adds each element from that iterable to the original list. Here&#8217;s an example of using the <code>extend()<\/code> method.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Initial list\noriginal_list = [1, 2, 3]\n\n# List to be added\nnew_elements = [4, 5, 6]\n\n# Using extend() to add new elements\noriginal_list.extend(new_elements)\n\nprint(original_list)\n# Output: [1, 2, 3, 4, 5, 6]\n<\/pre>\n\n\n\n<p>The <code>extend()<\/code> method in Python allows you to add multiple elements to a list. It takes an iterable object, such as a list or a tuple, as an argument and adds each element from that iterable to the original list. Here&#8217;s an example of using the <code>extend()<\/code> method with lists containing numbers.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Initial list\noriginal_list = [1, 2, 3]\n\n# List to be added\nnew_elements = [4, 5, 6]\n\n# Using extend() to add new elements\noriginal_list.extend(new_elements)\n\nprint(original_list) # Output: [1, 2, 3, 4, 5, 6]\n<\/pre>\n\n\n\n<p>As you can see, the <code>extend()<\/code> method has added the elements from the <code>new_elements<\/code> list to the <code>original_list<\/code>. Another example, this time with lists of words.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Initial list\noriginal_list = ['apple', 'banana', 'cherry']\n\n# Tuple to be added\nnew_elements = ('date', 'elderberry')\n\n# Using extend() to add new elements\noriginal_list.extend(new_elements)\n\nprint(original_list)\n# Output: ['apple', 'banana', 'cherry', 'date', 'elderberry']\n<\/pre>\n\n\n\n<p>As you can see, the <code><a href=\"https:\/\/www.datacamp.com\/tutorial\/python-list-methods\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">extend()<\/a><\/code> method can be used to add elements of any iterable object to a list. It is important to note that the <code>extend()<\/code> method modifies the original list in place, meaning that it doesn&#8217;t return a new list but modifies the original list. If you want to create a new list with the added elements, you can use the addition (+) operator to concatenate the original list with the new elements.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-3-python-insert-method\"><span class=\"ez-toc-section\" id=\"33-python-insert-method\"><\/span>3.3 Python insert method<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The <code>insert()<\/code> method in Python is used to insert an element at a specific position in a list. The syntax for the insert method is as follows, in the first example. <\/p>\n\n\n\n<p><strong><em>Index<\/em><\/strong> is the position where the element should be inserted, and <code>element<\/code> is the value to be inserted. ere is an example of how to use the <code>insert()<\/code> method to add the value <em>cherry<\/em> at the third position of a list of fruits.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">list.insert(index, element)\n\nfruits = [\"apple\", \"banana\", \"orange\"]\nfruits.insert(2, \"cherry\")\nprint(fruits)\n\n# output: [\"apple\", \"banana\", \"cherry\", \"orange\"]\n<\/pre>\n\n\n\n<p>As you can see in the script above, the <code>insert()<\/code> method can be used to add an element at a specific position in a list. The index starts from 0.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-4-python-remove-method\"><span class=\"ez-toc-section\" id=\"34-python-remove-method\"><\/span>3.4 Python remove method<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><code>element<\/code> is the value to be removed from the list. If the specified element is not found in the list, a <code>ValueError<\/code> is raised. In the second example below is on how to use the <code>remove()<\/code> method to remove the value &#8220;banana&#8221; from a list of fruits.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#generic syntax\nlist.remove(element)\n\nfruits = [\"apple\", \"banana\", \"orange\"]\nfruits.remove(\"banana\")\n\nprint(fruits)\n# the output is :[\"apple\", \"orange\"]\n<\/pre>\n\n\n\n<p>As you can see, the &#8220;banana&#8221; has been removed from the list. You can also use the <strong>Python del statement<\/strong> to remove an element by its index position.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">fruits = [\"apple\", \"banana\", \"orange\"]\ndel fruits[1]\n\nprint(fruits)\n# the output is :[\"apple\", \"orange\"]\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-5-python-lists-pop-method\"><span class=\"ez-toc-section\" id=\"35-python-lists-pop-method\"><\/span>3.5 Python lists pop method<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The <code>remove()<\/code> method in Python is used to remove the first occurrence of a specific value from a list. The syntax to use the <code>remove()<\/code> Python method is like in the script below, it removes the number 3 from the list and displays it using the print function.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">numbers = [1, 2, 3]\nlast_number = numbers.pop()\nprint(last_number)\n# displays :3\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-6-python-lists-index-method\"><span class=\"ez-toc-section\" id=\"36-python-lists-index-method\"><\/span>3.6 Python lists index method<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The <code>index()<\/code> method in Python is used to find the index of the first occurrence of a given item in a list. The item to be searched is passed as an argument to the method. If the item is not found in the list, a <code>ValueError<\/code> is raised.<\/p>\n\n\n\n<p>Here is an example of using the <code>index()<\/code> method to find the index of an item in a list.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">my_list = [1, 2, 3, 4, 5]\nmy_list.index(3)\n# result:2\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-7-python-lists-count-method\"><span class=\"ez-toc-section\" id=\"37-python-lists-count-method\"><\/span>3.7 Python lists count method<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The <code>count()<\/code> method in Python is used to find the number of occurrences of a given item in a list. The item to be searched is passed as an argument to the method. If the item is not found in the list, it will return 0.<\/p>\n\n\n\n<p>Here is an example of using the <code>count()<\/code> method to find the number of occurrences of an item in a list. This simple Python script counts the number of occurrences of the number 3, i.e., 2.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">my_list = [1, 2, 3, 3, 4, 5, 6, 7, 7, 8]\nmy_list.count(3)\n2\n<\/pre>\n\n\n\n<p>These selects examples are just a few amongst the many built-in methods available for working with lists in Python.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-4-list-comprehension\"><span class=\"ez-toc-section\" id=\"4-list-comprehension\"><\/span>4. List comprehension<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>List comprehension is a concise way to create a new list from an existing list. It&#8217;s a way to transform one list into another list, or to create new Python lists that meets certain criteria.<br>For example, here&#8217;s a way to use list comprehension to create a new list of the squares of the numbers in an existing list.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">numbers = [1, 2, 3, 4, 5]\nsquares = [num ** 2 for num in numbers]\n\nprint(squares)\n# result: [1, 4, 9, 16, 25]\n<\/pre>\n\n\n\n<p>You can also use conditionals in list comprehension to filter the items in the list. For example, here&#8217;s how to use list comprehension to create a new list of even numbers in an existing list. The Python script uses the <a href=\"https:\/\/betterexplained.com\/articles\/fun-with-modular-arithmetic\/\" target=\"_blank\" rel=\"noreferrer noopener\">modulo<\/a> function.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">numbers = [1, 2, 3, 4, 5]\neven_numbers = [num for num in numbers if num % 2 == 0]\n\nprint(even_numbers)\n# prints: [2, 4]\n<\/pre>\n\n\n\n<p>In the next chapter of the tutorial about multidimensional lists, we&#8217;ll use the <a href=\"https:\/\/expert-only.com\/en\/python\/python-modules\/\">Python modules concepts<\/a> to retrieve data in specific positions from a 2D matrix.  <\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"KNG4uKu5k4\"><a href=\"https:\/\/expert-only.com\/en\/python\/python-modules\/\">Python Modules<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Python Modules&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/python\/python-modules\/embed\/#?secret=ZI9V3WPYxu#?secret=KNG4uKu5k4\" data-secret=\"KNG4uKu5k4\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-5-multidimensional-lists-in-python\"><span class=\"ez-toc-section\" id=\"5-multidimensional-lists-in-python\"><\/span>5. Multidimensional lists in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python also supports Multidimensional Lists (lists of lists). They can be created by nesting lists, i.e., list of lists. For example, a <strong><em>2D matrix<\/em><\/strong> could be represented as a list of lists.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n\nprint(matrix[0][0])\n# 1\n\nprint(matrix[2][2])\n# 9\n<\/pre>\n\n\n\n<p>You can also use list comprehension for multidimensional lists. For example, you can use a nested list comprehension to extract a specific column from a matrix. The following matrix has 3 rows and 3 columns. The scripts below written in Python displays the second element of each row of the matrix.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n\ncolumn = [row[1] for row in matrix]\n\nprint(column)\n# prints: [2, 5, 8]\n<\/pre>\n\n\n\n<p>A matrix is a rectangular array of numbers, symbols, or expressions, arranged in rows and columns. Matrices are often used to represent and manipulate large sets of data, such as in linear algebra, physics, and computer graphics. <\/p>\n\n\n\n<p>In IT, matrices are used to represent arrays and are often used in data structures like 2D arrays and 3D arrays. They are also used in image processing and computer graphics to represent images and other visual data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-6-conclusion-on-using-the-python-lists\"><span class=\"ez-toc-section\" id=\"6-conclusion-on-using-the-python-lists\"><\/span>6. Conclusion on using the Python lists<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In summary, lists in Python are a powerful tool for organizing and manipulating data. They can be used for various operations such as appending, extending, inserting, and removing items. Additionally, list comprehension is a useful feature for creating new lists in a concise and readable way, and filtering items based on conditions. Python also supports multidimensional lists, which can be useful in mathematical, scientific, and game development applications. With practice, you can use lists to build complex and dynamic programs.<\/p>\n\n\n\n<p>In most of the IT projects, scripting is used along side with SQL, here a tutorial with <a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-data-types\/\">the list of all the T-SQL data types<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"G5zM8NHQnK\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-data-types\/\">SQL Server data types with code examples to create columns<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;SQL Server data types with code examples to create columns&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-data-types\/embed\/#?secret=LRelmwJT1w#?secret=G5zM8NHQnK\" data-secret=\"G5zM8NHQnK\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Tutorial on Python lists and how to create, append, modify, index, insert or delete elements with scripts examples. Lists are a fundamental data structure in Python and understanding how to use them effectively is crucial for any Python developer. <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/\" title=\"Python lists\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":7670,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[657],"tags":[],"class_list":{"0":"post-21121","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python lists - Code examples - Python tutorials<\/title>\n<meta name=\"description\" content=\"Python lists are a built-in data type structure that allows users to store and manipulate a collection of items using methods.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/python\/python-lists\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python lists\" \/>\n<meta property=\"og:description\" content=\"Python lists are a built-in data type structure that allows users to store and manipulate a collection of items using methods.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/python\/python-lists\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-15T04:57:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-12T17:21:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/05\/work-DE8FCB57747_1920x1080.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"Python lists\",\"datePublished\":\"2022-12-15T04:57:00+00:00\",\"dateModified\":\"2023-01-12T17:21:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/\"},\"wordCount\":1747,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/05\/work-DE8FCB57747_1920x1080.jpeg\",\"articleSection\":[\"Python tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/python\/python-lists\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/\",\"url\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/\",\"name\":\"Python lists - Code examples - Python tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/05\/work-DE8FCB57747_1920x1080.jpeg\",\"datePublished\":\"2022-12-15T04:57:00+00:00\",\"dateModified\":\"2023-01-12T17:21:21+00:00\",\"description\":\"Python lists are a built-in data type structure that allows users to store and manipulate a collection of items using methods.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/python\/python-lists\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/05\/work-DE8FCB57747_1920x1080.jpeg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/05\/work-DE8FCB57747_1920x1080.jpeg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/python\/python-lists\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python lists\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python lists - Code examples - Python tutorials","description":"Python lists are a built-in data type structure that allows users to store and manipulate a collection of items using methods.","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:\/\/expert-only.com\/en\/python\/python-lists\/","og_locale":"en_US","og_type":"article","og_title":"Python lists","og_description":"Python lists are a built-in data type structure that allows users to store and manipulate a collection of items using methods.","og_url":"https:\/\/expert-only.com\/en\/python\/python-lists\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2022-12-15T04:57:00+00:00","article_modified_time":"2023-01-12T17:21:21+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/05\/work-DE8FCB57747_1920x1080.jpeg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/python\/python-lists\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/python\/python-lists\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"Python lists","datePublished":"2022-12-15T04:57:00+00:00","dateModified":"2023-01-12T17:21:21+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/python\/python-lists\/"},"wordCount":1747,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/python\/python-lists\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/05\/work-DE8FCB57747_1920x1080.jpeg","articleSection":["Python tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/python\/python-lists\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/python\/python-lists\/","url":"https:\/\/expert-only.com\/en\/python\/python-lists\/","name":"Python lists - Code examples - Python tutorials","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/python\/python-lists\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/python\/python-lists\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/05\/work-DE8FCB57747_1920x1080.jpeg","datePublished":"2022-12-15T04:57:00+00:00","dateModified":"2023-01-12T17:21:21+00:00","description":"Python lists are a built-in data type structure that allows users to store and manipulate a collection of items using methods.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/python\/python-lists\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/python\/python-lists\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/python\/python-lists\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/05\/work-DE8FCB57747_1920x1080.jpeg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/05\/work-DE8FCB57747_1920x1080.jpeg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/python\/python-lists\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"Python lists"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/21121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=21121"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/21121\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/7670"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=21121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=21121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=21121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}