You are viewing a single comment's thread. Return to all comments →
sorted(iterable, reverse=True) iterates over the elements in iterable in reverse sorting order. That is, in descending order.
For instance (python 3)
print(list(sorted([1, 3, 5, 2], reverse=True)))
gives
[5, 3, 2, 1]
whereas
print(list(sorted([1, 3, 5, 2])))
[1, 2, 3, 5]
Seems like cookies are disabled on this browser, please enable them to open this website
Marc's Cakewalk
You are viewing a single comment's thread. Return to all comments →
sorted(iterable, reverse=True) iterates over the elements in iterable in reverse sorting order. That is, in descending order.
For instance (python 3)
gives
whereas
gives