I was trying to test how the lists in python works according to a tutorial I was reading.
When I tried to use list.sort()
or list.reverse()
, the in
A simple ascending sort is very easy, call the sorted() function. It returns a new sorted list:
>>> sorted([66.25, 333, 333, 1, 1234.5])
[1, 66.25, 333, 333, 1234.5]
sorted() accept a reverse parameter with a boolean value.
>>> sorted([66.25, 333, 333, 1, 1234.5], reverse=True)
[1234.5, 333, 333, 66.25, 1]