In this program, we will take a user input as a list and split the list into two-part, the left side all odd values and the right side all even values i.e. split the list with the help of the below-given steps.
Split the list:
Steps to solve the program
- Take a list as input and create two empty lists.
- Add even and odd elements from the given list into the empty list with the help of for loop.
- Combine odd element list with even element list using extend().
- Print the output.
Output :
Related Articles
Python program to get common elements from two lists.
Python program to reverse a list with for loop.
Python program to reverse a list with a while loop.
Python program to reverse a list using index slicing.
Python program to reverse a list with reversed and reverse methods.
Python program to copy or clone one list to another list.