0
Please explain how " rocket " is on index 1 and "plane" on index 4
m=["car","plane","train","bike","rocket"] n=sorted (m, key=lambda x: x[-2]) print(n)
1 ответ
+ 1
The lambda specifies that the items in list <m> are to be sorted by the second to last character of the items.
car -> a
rocket -> e
train -> i
bike -> k
plane -> n
See? the items are sorted by the second to the last character.