{"id":4959,"date":"2021-11-26T10:10:41","date_gmt":"2021-11-26T10:10:41","guid":{"rendered":"https:\/\/statanalytica.com\/blog\/?p=4959"},"modified":"2021-11-27T13:58:38","modified_gmt":"2021-11-27T13:58:38","slug":"python-array","status":"publish","type":"post","link":"https:\/\/statanalytica.com\/blog\/python-array\/","title":{"rendered":"Python Array: A Step By Step Guide With Examples For Beginners"},"content":{"rendered":"\n<p><em>Being a Python user, you might have encountered a condition where you need to work using various values of similar data types. Well, this is possible using the Python array.&nbsp;<\/em><\/p>\n\n\n\n<p>In a situation like when you need to store the relative data and perform the same operation simultaneously, you can use an array. Suppose you need to make a salary report of the employees working in a department. For that, you can add the employee&#8217;s name, phone numbers, salary pay, and more. And execute the operation on the salary to count the total salary pay of the department.<\/p>\n\n\n\n<p>So, how to create a Python array and how to add or remove the elements from an array? Don&#8217;t have any idea regarding it. Let me explain it to you with a suitable example. So, let&#8217;s start with the step-by-step details.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"what-is-an-array-in-python\"><\/span><strong>What is an array in Python?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a24a74b499af\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ff5104;color:#ff5104\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ff5104;color:#ff5104\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a24a74b499af\" checked aria-label=\"Toggle\" \/><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:\/\/statanalytica.com\/blog\/python-array\/#what-is-an-array-in-python\" >What is an array 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-2\" href=\"https:\/\/statanalytica.com\/blog\/python-array\/#how-to-create-an-array-in-python\" >How to create an array in Python?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/statanalytica.com\/blog\/python-array\/#how-can-you-add-the-elements-to-an-array\" >How can you add the elements to an array?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/statanalytica.com\/blog\/python-array\/#is-it-possible-to-remove-elements-from-an-array-in-python\" >Is it possible to remove elements from an array 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:\/\/statanalytica.com\/blog\/python-array\/#how-to-search-the-element-from-a-define-array-in-python\" >How to search the element from a define array 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:\/\/statanalytica.com\/blog\/python-array\/#what-if-you-want-to-update-the-python-arrays-elements\" >What if you want to update the Python arrays elements?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/statanalytica.com\/blog\/python-array\/#also-read\" >Also read..!!<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/statanalytica.com\/blog\/python-array\/#conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/statanalytica.com\/blog\/python-array\/#faqs-frequently-asked-questions\" >FAQ&#8217;s (Frequently Asked Questions)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/statanalytica.com\/blog\/python-array\/#why-is-array-important-in-programming\" >Why is array important in programming?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/statanalytica.com\/blog\/python-array\/#what-are-the-limitations-of-the-array\" >What are the limitations of the array?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/statanalytica.com\/blog\/python-array\/#what-data-type-is-an-array\" >What data type is an array?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n\n<p>If you know about built-in data structures, you are aware that the Python array is one of those. An array is useful for storing and organizing data. Moreover, Python users can use the array to change or retrieve that data.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/F0-K3VRQP_YNRUJJNQmkH69HoNrI63rUcrUqpmH3CWwLIBE8Zv6hO3g4j1skKa4Ira67K5P3smbhIq-WFSa4MT7xV0U9tiDjwn8nSfahnmCmcye8dxXwvnuvCQSI_Rfvg6n2efMS\" alt=\"\" width=\"665\" height=\"190\"\/><\/figure>\n\n\n\n<p>Suppose you need to list out the name of the students. For this, you have to store them in the array. An array in Python can be beneficial to use where users want to use various values of the same data types. Using the Python array, you can perform similar operations over multiple values.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"how-to-create-an-array-in-python\"><\/span><strong>How to create an array in Python?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>It is quite easy to create the array Python. You just need to import the array modules. Use <strong>array(<\/strong><strong><em>data_type<\/em><\/strong><strong>, <\/strong><strong><em>value_list<\/em><\/strong><strong>) <\/strong>for creating the array with the data type. But you need to define the value list in its arguments.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>import<\/strong> <strong>array<\/strong> <strong>as<\/strong> <strong>arr<\/strong><br>&nbsp;<br><em># creating an array with integer type<\/em><br>x = arr.array(&#8216;i&#8217;, [1, 2, 3])<br>&nbsp;<br><em># printing original array<\/em><br>print (&#8220;The new created array is : &#8220;, end =&#8221; &#8220;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 3):<br>&nbsp;&nbsp;&nbsp;&nbsp;print (x[i], end =&#8221; &#8220;)<br>print()<br>&nbsp;<br><em># creating an array with float type<\/em><br>y = arr.array(&#8216;d&#8217;, [4.5, 5.5, 6.5])<br>&nbsp;<br><em># printing original array<\/em><br>print (&#8220;The new created array is : &#8220;, end =&#8221; &#8220;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 3):<br>&nbsp;&nbsp;&nbsp;&nbsp;print (y[i], end =&#8221; &#8220;)<br>print()<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<p>The new created array is :&nbsp; 1 2 3&nbsp;<\/p>\n\n\n\n<p>The new created array is :&nbsp; 4.5 5.5 6.5<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"how-can-you-add-the-elements-to-an-array\"><\/span><strong>How can you add the elements to an array?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The elements in the Python array can easily add with the help of the built-in insert() function. This function uses to add one or multiple elements within the array.&nbsp;<\/p>\n\n\n\n<p>Depending on the requirements, Python users can add any element in any place of the array. This is possible using the index of the array.&nbsp;<\/p>\n\n\n\n<p><strong>NOTE: <\/strong>You can use the .append() method to add the elements at the end of the array.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><em># importing &#8220;array&#8221; for array creations<\/em><br><strong>import<\/strong> <strong>array<\/strong> <strong>as<\/strong> <strong>arr<\/strong><br><br><em># array with int type<\/em><br>x = arr.array(&#8216;i&#8217;, [1, 2, 3])<br>print (&#8220;Array before the insertion : &#8220;, end =&#8221; &#8220;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 3):&nbsp;&nbsp;&nbsp;&nbsp;<br>print (x[i], end =&#8221; &#8220;)<br>print()&nbsp;<br><br><em># inserting array&nbsp;<\/em><br>x.insert(4, 4)&nbsp;print (&#8220;Array after the insertion : &#8220;, end =&#8221; &#8220;)<br><strong>for<\/strong> i <strong>in<\/strong> (x):&nbsp;&nbsp;&nbsp;&nbsp;<br>print (i, end =&#8221; &#8220;)<br>print()&nbsp;<br><br><em># array with float type<\/em><br>y = arr.array(&#8216;d&#8217;, [1.5, 2.5, 3.5])<br>print (&#8220;Array before the insertion : &#8220;, end =&#8221; &#8220;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 3):&nbsp;&nbsp;&nbsp;&nbsp;<br>print (y[i], end =&#8221; &#8220;)<br>print()&nbsp;<br><br><em># adding an element using append()<\/em><br>y.append(4.5)&nbsp;<br>print (&#8220;Array after the insertion : &#8220;, end =&#8221; &#8220;)<br><strong>for<\/strong> i <strong>in<\/strong> (y):&nbsp;&nbsp;&nbsp;&nbsp;<br>print (i, end =&#8221; &#8220;)<br>print()<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<p>Array before the insertion :&nbsp; 1 2 3&nbsp;<\/p>\n\n\n\n<p>Array after the insertion :&nbsp; 1 2 3 4&nbsp;<\/p>\n\n\n\n<p>Array before the insertion :&nbsp; 1.5 2.5 3.5&nbsp;<\/p>\n\n\n\n<p>Array after the insertion :&nbsp; 1.5 2.5 3.5 4.5&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"is-it-possible-to-remove-elements-from-an-array-in-python\"><\/span><strong>Is it possible to remove elements from an array in Python?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Yes, it is!&nbsp;<\/p>\n\n\n\n<p>If you declare array Python, you can also easily remove the element from it. To remove it, you can use the built-in remove() function. This function can remove a component at a time. But if you want to remove all the elements simultaneously, you can use an iterator.&nbsp;<\/p>\n\n\n\n<p>For this, the pop() function is a useful method for removing and returning the elements from the given array. If you use it by default, then it will remove the last element from the array.&nbsp;<\/p>\n\n\n\n<p>But if you have to remove a specific element of an index number, then you need to pass the argument to the pop() method.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>import<\/strong> <strong>array<\/strong>&nbsp;&nbsp;<br><br><em># initializing array&nbsp;<\/em><br>arr = array.array(&#8216;i&#8217;, [2, 4, 6, 2, 8])&nbsp;<br><br><em># printing the original array<\/em><br>print (&#8220;The new array is : &#8220;, end =&#8221;&#8221;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 5):&nbsp;&nbsp;&nbsp;&nbsp;<br>print (arr[i], end =&#8221; &#8220;)&nbsp;<br>print (&#8220;<strong>\\r<\/strong>&#8220;)&nbsp;<br><br><em># using pop() to remove component at 2nd position<\/em><br>print (&#8220;The popped element is : &#8220;, end =&#8221;&#8221;)<br>print (arr.pop(2))&nbsp;<br><br><em># printing array after popping<\/em><br>print (&#8220;The array after popping is : &#8220;, end =&#8221;&#8221;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 4):&nbsp;&nbsp;&nbsp;&nbsp;print (arr[i], end =&#8221; &#8220;)&nbsp;<br>print(&#8220;<strong>\\r<\/strong>&#8220;)&nbsp;<br><br><em># using remove() to remove 1st occurrence of 1<\/em><br>arr.remove(2)<br><br><em># printing array after removing<\/em><br>print (&#8220;The array after the removing will be : &#8220;, end =&#8221;&#8221;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 3):&nbsp;&nbsp;&nbsp;&nbsp;<br>print (arr[i], end =&#8221; &#8220;)&nbsp;&nbsp;&nbsp;&nbsp;<br>print(&#8220;<strong>\\r<\/strong>&#8220;)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<p>The new array is : 2 4 6 2 8&nbsp;<\/p>\n\n\n\n<p>The popped element is : 6<\/p>\n\n\n\n<p>The array after popping is : 2 4 2 8&nbsp;<\/p>\n\n\n\n<p>The array after the removing will be : 4 2 8&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"how-to-search-the-element-from-a-define-array-in-python\"><\/span><strong>How to search the element from a define array in Python?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Sometimes, there is a need to search for the elements that are defined in the array. To do this, you need to use the index() in-built method. This will return the value&#8217;s first occurrence index that is mentioned within the arguments.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>import<\/strong> <strong>array<\/strong>&nbsp;&nbsp;<br><br><em># initializing array&nbsp;<\/em><br>arr = array.array(&#8216;i&#8217;, [4, 5, 6, 4, 5, 8])&nbsp;<br><br><em># printing original array<\/em><br>print (&#8220;The new array is : &#8220;, end =&#8221;&#8221;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 6):&nbsp;&nbsp;&nbsp;&nbsp;<br>print (arr[i], end =&#8221; &#8220;)&nbsp;<br>print (&#8220;<strong>\\r<\/strong>&#8220;)&nbsp;<br><br><em># using index() to print index of 5<\/em><br>print (&#8220;The index of 5 is : &#8220;, end =&#8221;&#8221;)<br>print (arr.index(5))&nbsp;<br><br><em># using index() to print index of 8<\/em><br>print (&#8220;The index of 8 is : &#8220;, end =&#8221;&#8221;)<br>print (arr.index(8))<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<p>The new array is : 4 5 6 4 5 8&nbsp;<\/p>\n\n\n\n<p>The index of 5 is : 1<\/p>\n\n\n\n<p>The index of 8 is : 5<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"what-if-you-want-to-update-the-python-arrays-elements\"><\/span><strong>What if you want to update the Python arrays elements?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>I have already declared that Python is one of the easiest programming languages. That is why it is quite easy to update the elements in the Python arrays. To do this, you have to reassign the value to indexed elements that you want to update.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><em># importing array module<\/em><br><strong>import<\/strong> <strong>array<\/strong>&nbsp;<br><em># initializing array<\/em><br>arr = array.array(&#8216;i&#8217;, [5, 6, 7, 5, 6, 8])&nbsp;<br><em># printing pre-defined array<\/em><br>print (&#8220;Array before any updation : &#8220;, end =&#8221;&#8221;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 6):&nbsp;&nbsp;&nbsp;&nbsp;<br>print (arr[i], end =&#8221; &#8220;)&nbsp;<br>print (&#8220;<strong>\\r<\/strong>&#8220;)&nbsp;<br><em># updating the element in a array<\/em><br>arr[2] = 10<br>print(&#8220;Array after updation : &#8220;, end =&#8221;&#8221;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 6):&nbsp;&nbsp;&nbsp;&nbsp;<br>print (arr[i], end =&#8221; &#8220;)<br>print()&nbsp;<br><em># updating the element in a array<\/em><br>arr[5] = 9<br>print(&#8220;Array after the updation : &#8220;, end =&#8221;&#8221;)<br><strong>for<\/strong> i <strong>in<\/strong> range (0, 6):&nbsp;&nbsp;&nbsp;&nbsp;<br>print (arr[i], end =&#8221; &#8220;)<br>print()<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<p>Array before any updation : 5 6 7 5 6 8&nbsp;<\/p>\n\n\n\n<p>Array after updation : 5 6 10 5 6 8&nbsp;<\/p>\n\n\n\n<p>Array after the updation : 5 6 10 5 6 9&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"also-read\"><\/span>Also read..!!<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><a style=\"font-size: 1rem; background-color: var(--ast-global-color-5);\" href=\"https:\/\/statanalytica.com\/blog\/linked-list-in-python\/\">What is Linked List in Python and How Does it Work?<\/a><\/li><li><a href=\"https:\/\/statanalytica.com\/blog\/data-science-projects-for-beginners\/\">25 Best Data Science Projects For Beginners \u2013 Step by Step<\/a><\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Python can be one of the best programming languages for beginners. Also, it is best for the person who has little prior knowledge of the programming language. Today, I have defined or mentioned all the necessary details about the Python array, how to define the Python array and more. Practice and understand the above examples to get a better knowledge of the concepts.&nbsp;<\/p>\n\n\n\n<p>Apart from this, you can do experiments with the above programs. This will help to understand the major points about Python arrays. If there is an issue with the Python programming, mail it to us. And our experts will resolve it in the best way.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"faqs-frequently-asked-questions\"><\/span>FAQ&#8217;s (<strong>Frequently Asked Questions<\/strong>)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1637907253887\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><span class=\"ez-toc-section\" id=\"why-is-array-important-in-programming\"><\/span><strong>Why is array important in programming?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Array consider as the most important data structure. And it is useful in various ways for implementing the other data structures like string and list. The Python array uses the computer&#8217;s addressing logic.\u00a0<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1637907261701\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><span class=\"ez-toc-section\" id=\"what-are-the-limitations-of-the-array\"><\/span><strong>What are the limitations of the array?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div class=\"rank-math-answer \">\n\n<p> While you are dealing with the arrays, either there will be wastage or storage of the memory. It means that shifting is necessary to delete or insert the elements within the array. <\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1637907274280\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><span class=\"ez-toc-section\" id=\"what-data-type-is-an-array\"><\/span><strong>What data type is an array?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>The array uses to represent the compound data type with the 8 numbers within the database dictionary. Python arrays can store elements&#8217; lists of similar data types. Further, they can access it using the index number. We can say that array can be synonymous with the terms <a href=\"https:\/\/en.wikipedia.org\/wiki\/Vector\" rel=\"nofollow noopener\" target=\"_blank\">vector<\/a>, list, and sequence.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Being a Python user, you might have encountered a condition where you need to work using various values of similar data types. Well, this is possible using the Python array.&nbsp; In a situation like when you need to store the relative data and perform the same operation simultaneously, you can use an array. Suppose you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4966,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[138],"tags":[891,890,894,889,893,892],"class_list":["post-4959","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","tag-array-in-python","tag-array-python","tag-define-array-in-python","tag-python-array","tag-python-arrays","tag-python-create-array"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/posts\/4959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/comments?post=4959"}],"version-history":[{"count":0,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/posts\/4959\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/media\/4966"}],"wp:attachment":[{"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/media?parent=4959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/categories?post=4959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statanalytica.com\/blog\/wp-json\/wp\/v2\/tags?post=4959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}