How can i print in descending order?

Fishhy

Below is my code I have printing this in ascending order I now need to print it in descending order but don't know how?

list = [37,-59,4,0,15,-12,9,0]
StephenTG

If you need the list both in ascending and descending order, you can get your list in reverse like so:

sorted_list_oldskool[::-1]

If you only need it in descending order, AMACB's answer is probably the most efficient.

If, for whatever reason you want to take your existing sorting logic and have it produce a list in descending order, you should change

if unsorted_list[i] <= sorted_list_oldskool[j]:

to

if unsorted_list[i] >= sorted_list_oldskool[j]:

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I sort comments in descending order?

From Dev

How can I paginate in descending order by child value with firebase?

From Dev

How can I paginate in descending order by child value with firebase?

From Dev

How to print the result in descending order in java?

From Dev

How to sort the atoms in descending order and print it out

From Dev

How to make this Perl program print in descending order?

From Dev

Java: How do I print out in descending order the values of a list of objects' properties?

From Dev

Java: How do I print out in descending order the values of a list of objects' properties?

From Dev

How do I sort and print the phrases along the rating given in descending order

From Dev

Similar to battleships. How do i print descending order with a border like so?

From Dev

how do i finish sorting this in descending order?

From Dev

How can I sort this array of objects by both its properties in descending order

From Dev

How can I make my query set order by descending in django based on auto increment id field

From Dev

How can i write in javascript three numbers in descending order using just `if ...else` statements?

From Dev

How can I make my Quick Sort Algorithm sort the arrays in both Ascending and Descending order?

From Dev

Why can I index a key in both ascending and descending order in MongoDB?

From Dev

How can I print a jinja dict in a deterministic order?

From Dev

How can I print items in an array in numerical order?

From Dev

how to order ascending descending?

From Dev

How to order by case, descending?

From Dev

How to print even numbers in ascending order and odd numbers in descending order without using collection

From Dev

print map values in descending order in c++

From Dev

How can I print this?

From Dev

How to sort in descending order with numpy?

From Dev

how to use awk command to find all 5 length files - and print in descending order

From Dev

How can get the value from the third table in laravel and order by with id in descending order

From Dev

How do I reverse order KnockoutJS array items so they are added to the top of the screen in descending order

From Dev

How can I extract 20% descending loss in this code?

From Dev

How can I print every different word from an input on a different line sorted in an alphabetical order? - Java

Related Related

  1. 1

    How can I sort comments in descending order?

  2. 2

    How can I paginate in descending order by child value with firebase?

  3. 3

    How can I paginate in descending order by child value with firebase?

  4. 4

    How to print the result in descending order in java?

  5. 5

    How to sort the atoms in descending order and print it out

  6. 6

    How to make this Perl program print in descending order?

  7. 7

    Java: How do I print out in descending order the values of a list of objects' properties?

  8. 8

    Java: How do I print out in descending order the values of a list of objects' properties?

  9. 9

    How do I sort and print the phrases along the rating given in descending order

  10. 10

    Similar to battleships. How do i print descending order with a border like so?

  11. 11

    how do i finish sorting this in descending order?

  12. 12

    How can I sort this array of objects by both its properties in descending order

  13. 13

    How can I make my query set order by descending in django based on auto increment id field

  14. 14

    How can i write in javascript three numbers in descending order using just `if ...else` statements?

  15. 15

    How can I make my Quick Sort Algorithm sort the arrays in both Ascending and Descending order?

  16. 16

    Why can I index a key in both ascending and descending order in MongoDB?

  17. 17

    How can I print a jinja dict in a deterministic order?

  18. 18

    How can I print items in an array in numerical order?

  19. 19

    how to order ascending descending?

  20. 20

    How to order by case, descending?

  21. 21

    How to print even numbers in ascending order and odd numbers in descending order without using collection

  22. 22

    print map values in descending order in c++

  23. 23

    How can I print this?

  24. 24

    How to sort in descending order with numpy?

  25. 25

    how to use awk command to find all 5 length files - and print in descending order

  26. 26

    How can get the value from the third table in laravel and order by with id in descending order

  27. 27

    How do I reverse order KnockoutJS array items so they are added to the top of the screen in descending order

  28. 28

    How can I extract 20% descending loss in this code?

  29. 29

    How can I print every different word from an input on a different line sorted in an alphabetical order? - Java

HotTag

Archive