I'm trying to sort a list consisting of names and numbers, in this case a persons name and their bowling score. I want to sort the list alphabetically and numerically. I'm having a hard time figuring out how to sort the list numerically. The list looks like this: ['', 'Ann, 40', 'Jeff, 250', 'Zane, 20']. Is there anyway I can use the built in sort function for the second element in the list rather than the first?
#Here is the code
l=['Ann, 40', 'Jeff, 250', 'Zane, 20']
l.sort(l[1])
for i in l:
print(i)
#l.sort(l[1]) does not work
The end goal will be to display
Jeff, 250
Ann, 40
Zane, 20