A = [1,2,3,4,5,6]
B = A[:len(A)//2]
C = A[len(A)//2:]

If you want a function:

def split_list(a_list):
    half = len(a_list)//2
    return a_list[:half], a_list[half:]

A = [1,2,3,4,5,6]
B, C = split_list(A)
Answer from Jason Coon on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-program-to-split-a-list-into-two-halves
Python Program to Split a List into Two Halves - GeeksforGeeks
July 23, 2025 - A second loop iterates over the second part of the list and adds each element to second_half. For working with numeric data or using the numpy library, numpy.array_split() provides a clean way to split lists (or arrays) into two or more parts.
Discussions

How can I split a Python list in half? - Ask a Question - TestMu AI (formerly LambdaTest) Community
How can I split a Python list in half? For example, if I have the list: A = [0, 1, 2, 3, 4, 5] I want to split it into two smaller lists: B = [0, 1, 2] C = [3, 4, 5] What is the best way to achieve this in Python? More on community.testmuai.com
🌐 community.testmuai.com
0
January 20, 2025
python - What is the most efficient way to split a list evenly in half - Stack Overflow
I need to split a list into halves such that if it has an odd length the middle element is ignored entirely, I have a function for this, but it's quite slow for what I'm trying to do. My function (variables renamed because they make no sense out of context): def splitList(array): half = ... More on stackoverflow.com
🌐 stackoverflow.com
Splitting an Array into two and Swapping the First Half With the Second Half
So this problem could actually be solved without any loops at all, just by using array splicing, you may want to take a look at that. Also, I'm not 100% sure, but I think in your odd example the output isn't actually what you want, since the 4 is out of place More on reddit.com
🌐 r/learnpython
13
3
May 18, 2020
Split list into smaller lists
There are likely some helper functions that make this possible in a line or two but it's almost 4am here so I'm drawing a blank. Doing it with a dumb loop is pretty simple though: def splitList(input, delim): # We'll return a list of lists outLists = [] # Read each item, if it's not the delimiter (e.g. "x") # add it to the current list. If it is the delimiter, # add the current list to the output and empty it. currentList = [] for item in input: if item == delim: if len(currentList) > 0: outLists.append(currentList) currentList = [] else: currentList.append(item) # If we get to the end and there are leftovers in the current # list, add them as well if len(currentList) > 0: outLists.append(currentList) return outLists You could call this like: splitList(your_list_above, "x") Might be some edge cases I'm not thinking of, maybe multiple delimiters in a row or something (?), didn't really test this but it should get you started Edit: Made a stupid mistake above but not going to fix it, should never use "input" as a variable, so call it something else, like "inputList" instead More on reddit.com
🌐 r/learnpython
12
1
January 6, 2021
🌐
TutorialsPoint
tutorialspoint.com › article › python-program-to-split-a-list-into-two-halves
Python Program to Split a List into Two Halves
March 27, 2026 - The most straightforward method to split a list is using Python's slicing technique. This approach divides the list at a specific index, creating two separate parts. When a list has an even number of elements, splitting results in two equal halves ?
🌐
pythoncodelab
pythoncodelab.com › home › how to split a list in half python
How to split a list in half Python - - pythoncodelab
November 2, 2024 - We have used list comprehension “[lst[i * part_size:(i + 1) * part_size] for i in range(parts)]” . In this code line we iterate through the range of parts and slice the list accordingly.
🌐
Delft Stack
delftstack.com › home › howto › python › split list in half in python
How to Split Python List in Half | Delft Stack
February 2, 2024 - We will half this value and use the list slicing method to split it in half.
🌐
datagy
datagy.io › home › python posts › python lists › python: split a list (in half, in chunks)
Python: Split a List (In Half, in Chunks) • datagy
December 30, 2022 - You can easily split a Python list in half using list indexing. As you learned above, you can select multiple items in a list using list slicing.
🌐
Entechin
entechin.com › home › how to split a list in half using python
How to Split a List in Half using Python Tutorial - Entechin
July 6, 2024 - In this case, the floor operator ... length of 4. Python’s NumPy library provides a built-in function, array_split(), that can divide a list into n parts....
Find elsewhere
🌐
Python Help
pythonhelp.org › python-lists › how-to-split-a-list-in-half-python
How to Split a List in Half in Python
October 17, 2023 - Python provides us an easy way to split a list into two halves using its in-built function ‘middle’. The Python list ‘middle’ method splits the list in half and returns a new list containing both ends of the original list.
🌐
Altcademy
altcademy.com › blog › how-to-split-a-list-in-python
How to split a list in Python - Altcademy.com
June 13, 2023 - The simplest way to split a list in Python is by using slicing. Slicing allows us to extract a portion of the list by specifying the start and end indices. The general syntax for slicing is list[start:end], where start is the index of the first ...
🌐
Finxter
blog.finxter.com › home › learn python blog › how to split a list in half in 5 ways
How to Split a List in Half in 5 Ways - Be on the Right Side of Change
July 15, 2022 - Above defines a function with one (1) argument (split_half(pop)). This function splits the list in half using the Right Shift Operator and returns the results as a Tuple with two (2) nested lists.
🌐
TestMu AI Community
community.testmuai.com › ask a question
How can I split a Python list in half? - Ask a Question - TestMu AI (formerly LambdaTest) Community
January 20, 2025 - How can I split a Python list in half? For example, if I have the list: A = [0, 1, 2, 3, 4, 5] I want to split it into two smaller lists: B = [0, 1, 2] C = [3, 4, 5] What is the best way to achieve this in Python?
🌐
Real Python
realpython.com › how-to-split-a-python-list-into-chunks
How to Split a Python List or Iterable Into Chunks – Real Python
January 27, 2025 - You can split a list into chunks without using a library by implementing a custom loop with slicing. You handle infinite data streams in Python by leveraging itertools.batched() for lazy evaluation.
🌐
Finxter
blog.finxter.com › 5-best-ways-to-split-a-python-list-into-two-halves
5 Best Ways to Split a Python List into Two Halves – Be on the Right Side of Change
This method involves splitting a list into two halves by using slice notation. Slice notation in Python allows us to access a subset of a list with a start, stop, and step parameters. By calculating the midpoint of the list, we can easily create two new lists representing the two halves.
🌐
Reddit
reddit.com › r/learnpython › splitting an array into two and swapping the first half with the second half
r/learnpython on Reddit: Splitting an Array into two and Swapping the First Half With the Second Half
May 18, 2020 -

Here's the algorithm:

array = [int(num) for num in input().split()]
len = len(array)

mid=int(len/2)

if mid%2==0:
    for i in range(mid):
        temp=array[i]
        array[i]=array[mid+i]
        array[mid + i]=temp
else:
    for i in range(mid):
        temp=array[i]
        array[i]=array[mid+i+1]
        array[mid + i + 1]=temp

print(array)

The issue is, the program has to decide between two loops depending on the length of the array (odd or even), which I think is very inefficient. Can someone suggest a way to bring this down to a single loop?

Sample I/O for even:

1 2 3 4 5 6 7 8
[5, 6, 7, 8, 1, 2, 3, 4]

Sample I/O for odd:

1 2 3 4 5 6 7 
[5, 6, 7, 4, 1, 2, 3]
🌐
GeeksforGeeks
geeksforgeeks.org › python-ways-to-spilt-the-list-by-some-value
How to Split the list by some value ? - GeeksforGeeks
December 18, 2024 - Method #1 : Using itemgetter ... Splitting a list into two halves is a common operation that can be useful in many cases, such as when dealing with large datasets or when performing specific algorithms (e.g., merge sort).
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-split-lists-in-python
How to Split Lists in Python? - GeeksforGeeks
July 23, 2025 - Explanation: Slicing operator : is used to divide the list into two parts, with the first slice containing elements up to index 3 and the second slice starting from index 3. For situations where you need to split a list into chunks of equal ...
🌐
Replit
replit.com › home › discover › how to split a list in python
How to split a list in Python | Replit
April 14, 2026 - Learn how to split a list in Python. Discover various methods, tips, real-world examples, and common error fixes for your code.