+ 1

How to reverse list?

I want to reverse items in the list but I'm getting o/p as none why is that so? My_list=[1,2,3,4] Print(My_list.reverse()]

27th Aug 2020, 4:29 AM
Prasad Bankar
Prasad Bankar - avatar
2 Answers
+ 4
def Reverse(lst):     lst.reverse()     return lst lst = [10, 11, 12, 13, 14, 15] print(Reverse(lst))
27th Aug 2020, 4:33 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
You ended with square brackets... you can also say print(my_list[::-1]) It's less typing
27th Aug 2020, 4:34 AM
Steven M
Steven M - avatar