Q. Read a list of n elements. Pass this list to a function which reverses this list in-place without creating a new list.


Answer :-


def pathwalla( lst ):
    return lst [ -1: -len(lst)-1 :-1 ]

lst = eval(input("Enter a list :-"))
print("Reverse List :-", pathwalla( lst) )

Post a Comment

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

Previous Post Next Post