I\'m supposed to create a function, which input is a list and two numbers, the function reverses the sublist which its place is indicated by the two numbers. for example this is
Try some crazy slicing, see Explain Python's slice notation and http://docs.python.org/2.3/whatsnew/section-slices.html
crazy slicing
x = [1,2,3,4,5,6,7,8] def sublist_reverse(start_rev, end_rev, lst): return lst[:end_rev-1:start_rev-1]+lst[:[end_rev] print sublist_reverse(0,4,x)
[out]:
[8, 7, 6, 5, 4, 3, 2, 1]