Question about reversed lists in Python -
i new python, able tell.
if have list:
a = [1,2,3,2,1] this evaluates true:
a == a[::-1] ...but evaluates false:
a == a.reverse() why case?
because .reverse() reverses list in-place , returns none:
>>> print a.reverse() none and a == none evaluates false.
Comments
Post a Comment