Parenthesis question in parentheses in python list

print (sorted (greens,key=
print (sorted (greens,key= (lambda XRX [2])
I sort by the third value of each element. But the sort is wrong. I think you need to add a parenthesis or square bracket to each element to sort it. How do you need to add things such as [["13recorder 910recorder 2"], [" 13recorder 910recorder 2"], ["0pr 912recorder 1"], [" 0recorder 914pr 3"], ["2pr 918rem 4"], [" 1pc 915je 6"]

May.02,2021

traverse the add list



greens=['13,910,2', '0,912,1', '0,914,3', '2,918,4', '1,915,6']
print(sorted(greens,key=(lambda x:int(x.split(',')[-1]))))
Does that mean

?

Menu