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]

CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad