Why the 2nd output is this?? (Python )
L1=[1,3,5,7,9] print (L1==L1.reverse ()) print (L1) 1st Output:False 2nd Output:[9,7,5,3,1] The 2nd expression is comparing the lists then why the list is changed.
L1.reverse() reverses the list "in place". This means that the actual list is changed (reversed) whenever you call this method. If you want a method that returns the reverse of L1, you can use reversed(L1).
L1.reverse() doesn't returns new list ,rather it reverses the elements of the original list try printing L1.reverse()
#try in python write this: help(list.reverse)