Split List

Split List

You have to split a given list into two lists inside an Iterable. If input sequence has an odd amount of elements, then the first list inside result Iterable should have more elements. If input sequence has no elements, then two empty lists inside result Iterable should be returned.

example

Input: A list.

Output: An Iterable of two lists.

Examples:

assert list(split_list([1, 2, 3, 4, 5, 6])) == [[1, 2, 3], [4, 5, 6]]
assert list(split_list([1, 2, 3])) == [[1, 2], [3]]
assert list(split_list(["banana", "apple", "orange", "cherry", "watermelon"])) == [
    ["banana", "apple", "orange"],
    ["cherry", "watermelon"],
]
assert list(split_list([1])) == [[1], []]
40