toryan
0
Q:

sort lexo python

arr = [1,4,2,7,5,6]
#sort in ascending order
arr = arr.sort() 

#sort in descending order
arr = arr.sort(reverse = True)
1
#code
def sortlexo(n):
    w = []
    for i in n:
        w.append(i)
    
    w.sort
    w = w[::-1]
    for i in w:
        print(i,end = "")
for i in range(int(input())):
    n= input()
    sortlexo(n)
0
cars = ['Ford', 'BMW', 'Volvo']
cars.sort() 
0

New to Communities?

Join the community