0

is there any built in function in python to sort a list of integers?

29th Sep 2020, 10:59 AM
WaYRđŸ‡§đŸ‡©
WaYRđŸ‡§đŸ‡© - avatar
3 Answers
+ 4
a = [1,4028,-2828,19,42,0] a.sort() #sort list a.
29th Sep 2020, 11:01 AM
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż - avatar
+ 4
Example - x=[1,2,3,4,5] x.sort() Now this will list the items from the list(list of x) Hope this helps ✌
29th Sep 2020, 11:09 AM
Piyush
Piyush - avatar
+ 1
Yes there is this function List.sort() = sort in ascending order List.sort(reverse=True)=sort in descending order
29th Sep 2020, 11:43 AM
Ajay