it is possible to use string for slice the list?
i have example like this
m = [1,2,3,4,5]
print(m[:-1])
print(m[1:-1:])
print(m[::2])
above code will result
[1, 2, 3, 4]
[2, 3, 4]
[1, 3, 5]
so i want use string to do something like that
m = [1,2,3,4,5]
inp = input('slice the list ')
#and user will input [:-1], [1:-1:], or [::2]
#slice the list using that input
#m[inp]??
if this possible, how to make this approach?
i cannot find answer for this anywhere or i just don't know what keyword should i type for search this