Q:

sorting function in python


a = (1, 11, 2)
x = sorted(a)
print(x)
 
4
sorted(list, key=..., reverse=...)
3
arr = [1,4,2,7,5,6]
#sort in ascending order
arr = arr.sort() 

#sort in descending order
arr = arr.sort(reverse = True)
1
List_name.sort()
This will sort the given list in ascending order.
1
python list sort()
0

New to Communities?

Join the community