how can I use python to sort()
list by letters from Z to A?
names = ["Adam","Alex","Mariah","Martine","Columbus"]
*beginner
how can I use python to sort()
list by letters from Z to A?
names = ["Adam","Alex","Mariah","Martine","Columbus"]
*beginner
By telling the sorted()
function or list.sort()
method to reverse
the output:
sorted(names, reverse=True) # returns new list
names.sort(reverse=True) # sorts list in place