sorted reverse
Hi,
Given the following example:
print ("Sorted") print(sorted([2.2, 5.6, 5.9], key=int)) print ("Sorted reverse") print(sorted([2.2, 5.6, 5.9], key=int, reverse=True))
It gives the following output:
>>> print ("Sorted") Sorted >>> print(sorted([2.2, 5.6, 5.9], key=int)) [2.2, 5.6, 5.9] >>> print ("Sorted reverse") Sorted reverse >>> print(sorted([2.2, 5.6, 5.9], key=int, reverse=True)) [5.6, 5.9, 2.2] >>>
Given the first print, i would be able to return max as:
sorted([2.2, 5.6, 5.9], key=int)[-1]
but i returns a different value than
sorted([2.2, 5.6, 5.9], key=int, reverse=True)[0]
Is this purely the order of the list ?