Reverse a range in a list Example
Input : test_list = [6, 3, 1, 8, 9, 2, 10, 12, 7, 4, 11], str, end = 3, 9
Output : [6, 3, 1, 7, 12, 10, 2, 9, 8, 4, 11]
Explanation : 8, 9, 2, 10, 12, 7 are reversed in list to 7, 12, 10, 2, 9, 8.Input : test_list = [6, 3, 1, 8, 9, 2, 10, 12, 7, 4, 11], str, end = 8, 9
Output : [6, 3, 1, 8, 9, 2, 10, 7, 12, 4, 11]
Explanation : 12, 7 are reversed in list to 7, 12.
Python program to Reverse a range in list
Given a List, our task is to write a Python program to reverse a range in the list.