Programming Examples
Python program that reverse the list of integers in place
Write a Python program that reverse a list of integers (in place)
Solution
mylist=eval(input("Enter any List"))
print("Before Reverse list is ",mylist)
mylist.reverse()
print("After Replace list is ",mylist)
Output
Enter any List[5,7,8,9]
Before Reverse list is [5, 7, 8, 9]
After Replace list is [9, 8, 7, 5]