Given a list
a = range(10)
You can slice it using statements such as
a[1] a[2:4]
However, I want to do th
Why does it have to be a single variable? Just use two variables:
i, j = 2, 4 a[i:j]
If it really needs to be a single variable you could use a tuple.