{"id":18181,"date":"2021-08-26T10:42:26","date_gmt":"2021-08-26T05:12:26","guid":{"rendered":"https:\/\/python-programs.com\/?p=18181"},"modified":"2021-11-22T18:37:12","modified_gmt":"2021-11-22T13:07:12","slug":"python-program-to-split-the-array-list-and-add-the-first-part-to-the-end","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-split-the-array-list-and-add-the-first-part-to-the-end\/","title":{"rendered":"Python Program to Split the Array\/List and add the First Part to the End"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Count Non Palindrome words in a Sentence<\/a>
\nGiven a list and a number N the task is to split and move the first N elements of the list to the end in Python.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given List =[11 22 33 44 55 66 77 88 99 111 222 333]\r\nNumber =2<\/pre>\n

Output:<\/strong><\/p>\n

The result part after moving first [ 2 ] numbers to the end is [33, 44, 55, 66, 77, 88, 99, 111, 222, 333, 11, 22]<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given List =[9, 3, 1, 11, 13, 18, 5, 0, 11, 35, 67, 24]\r\nNumber =4<\/pre>\n

Output:<\/strong><\/p>\n

The result part after moving first [ 4 ] numbers to the end is [13, 18, 5, 0, 11, 35, 67, 24, 9, 3, 1, 11]<\/pre>\n

Program to Split the Array\/List and add the First Part to the End in Python<\/h2>\n

In Python, there are various ways to split the list and add the first portion at the end, some of them are as follows<\/p>\n