Function to return elements from a list in Python
<p>I have a function:</p>

<pre><code>def funky(a):
    c = [4,5,6]
    return c[a]
</code></pre>

<p>I would like to be able to call:</p>

<pre><code>funky(0:1)
</code></pre>

<p>And</p>

<pre><code>funky(0,1)
</code></pre>

<p>To get the same response [4,5]. How do I modify 'funky' to do this?</p>

<p>Enter slice(0, 1) as a parameter to your function as is. 0:1 won't work ever as it is not a passable parameter. </p>

python list