Separate list into two equal parts with slices
<p>I need to write a function that splits any list into two equal parts. If length of list is even, I want just split it it two parts, and if length of the list is odd, I want to ignore central element.</p>

<pre><code>So [1,2,3,4,5,6] =&gt; [1,2,3] and [4,5,6]
and [1,2,3,4,5] =&gt; [1,2] and [4,5]
</code></pre>

<p>I tried to do the following way:</p>

<pre><code>list = [1,100,50,-51,1,1]
s = len(list)/2
left = list[s+1:]
right = list[:s]
</code></pre>

<p>But this approach doesnt work both for even and odd lengths. 
Is there a way to use slices for this purpose or there is no way and it's better to use loops/iterations?</p>

<p>How about using negative indexing on the right half?</p>

<pre><code>def separate(seq):
    s = len(seq)/2
    left = seq[:s]
    right = seq[-s:]
    return left, right

print separate([1,2,3,4,5,6])
#result: ([1, 2, 3], [4, 5, 6])
print separate([1,2,3,4,5])
#result: ([1, 2], [4, 5])
</code></pre>

python