0
[Challenge] Decimal Sorter
A script which first sorts decimal numbers by highest - lowest and then lowest - highest Decimals: 0,2885 0,00653 0,006406 0,916 0,3306
2 Answers
+ 1
numbers = [ 0.2885, 0.00653, 0.006406, 0.916, 0.3306]
print(sorted(numbers))
print("\n", sorted(numbers)[::-1])
you get the general idea :) . p.s. this doesn't sort the decimals it only gives a sorted output
+ 1
using sort method it is possible to sort a list in place also in reverse order.