Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created June 15, 2020 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/8bb8891feeda8da5e7302b3ab4cc73a4 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/8bb8891feeda8da5e7302b3ab4cc73a4 to your computer and use it in GitHub Desktop.
s1={1,3,5,7,9,2,4,6,8}
#Returns list of sorted elements
print (sorted(s1))
#Output:[1, 2, 3, 4, 5, 6, 7, 8, 9]]
#Sorting in descending order
print (sorted(s1,reverse=True))
#Output:[9, 8, 7, 6, 5, 4, 3, 2, 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment