def reverseArr(arr, start, end):while(start < end):arr[start], arr[end] = arr[end], arr[start]start +=1;end -=1def fun(arr,d, n):reverseArr(arr,0, n-1)reverseArr(arr, n-d, n-1)reverseArr(arr,0, n-d-1)arr = [1,2,3,4,5,6,7]
fun(arr,2,len(arr))
print(arr)