Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created Jun 15, 2020
Embed
What would you like to do?
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