I know that this sounds trivial but I did not realize that the sort() function of Python was weird. I have a list of \"numbers\" that are actually in string for
sort()
Try this, it’ll sort the list in-place in descending order (there’s no need to specify a key in this case):
Process
listB = [24, 13, -15, -36, 8, 22, 48, 25, 46, -9] listC = sorted(listB, reverse=True) # listB remains untouched print listC
output:
[48, 46, 25, 24, 22, 13, 8, -9, -15, -36]