def reverseList(A, start, end): if start < end: A[start], A[end] = A[end], A[start] start = start + 1 end = end - 1 A = [1,2,3,4] reverseList(A, 0, 3) print(A)
To embed this project on your website, copy the following code and paste it into your website's HTML: