Apr-19-2022, 06:50 PM
(This post was last modified: Apr-19-2022, 06:51 PM by Gribouillis.)
When
a
is a list, a.sort()
sorts the list in place, but the call to a.sort()
returns None
>>> a = [1, 8, 4, 2] >>> a.sort() >>> a [1, 2, 4, 8] >>> a.sort() is None TrueHence you are testing
None == None
, which always returns True
.