+ 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()]
3 Réponses
+ 4
def Reverse(lst):
lst.reverse()
return lst
lst = [10, 11, 12, 13, 14, 15]
print(Reverse(lst))
+ 2
You ended with square brackets... you can also say
print(my_list[::-1])
It's less typing