Q. Write a program that reverse an array of integer (in place).


You can understand by Watching video :-



Answer :-

lst = eval(input("Enter a list = "))
lst.reverse()
print(lst)

Output :-

Enter a list = [1,2,3,4,5,6,7,8,9]
[9, 8, 7, 6, 5, 4, 3, 2, 1]

>>> 

Enter a list = [89,674,53,53,456,16]
[16, 456, 53, 53, 674, 89]

>>> 

Enter a list = [2,4,6,8,1,3,5,7,9]
[9, 7, 5, 3, 1, 8, 6, 4, 2]

>>> 


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post