I have a list which contains the following
a= [june,32,may,67,april,1,dec,99]
I want to sort only the numbers in descending order but it should display with corresponding pair:
Output Expected
----------------
dec,99,may,67,june,32,april,1
I tried to sort using a.sort(reverse=True) command in the list not getting the expected output,this one is confusing a lot.
a = ['june',32,'may',67,'april',1,'dec',99]a = [x for s in [[b,a] for a,b in sorted([(a[i],a[i-1]) for i in range(len(a)) if i%2 == 1],reverse=True)] for x in s]