Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First: slice at (n+1)/2 solution in Clear category for Split List by leggewie
def split_list(items: list) -> list:
n=len(items)
if n == 0:
return [[],[]]
elif n == 1:
return [items, []]
else:
return [items[:int((n+1)/2)], items[int((n+1)/2):]]
May 31, 2021
Comments: