0
What is the simplest way to reverse a list in python without using any inbuilt function ?
We can use slicing technique to reverse a list in single step. e.g. list=[1,2,3,4,5,6,7,8,9] print(list[::-1]) It will print [9,8,7,6,5,4,3,2,1].
1 Answer
+ 4
python has three ways to reverse a list
list[::-1]
reversed(list)
list.reverse()
pick one of them