Home > other >  To help explain these questions
To help explain these questions

Time:11-10

X=93, known [filling [1], [2,3,1]], the expression sorted (x, key=lambda item: the item [0] + item [2]) has a value of

[[2, 3, 1], [1, 3, 3]]
1
X=94, known [filling [1], [2,3,1]], the expression sorted (x, key=lambda item: (item [1], the item [2])) has a value of

[[2, 3, 1], [1, 3, 3]]
1
X=95, known [filling [1], [2,3,1]], the expression sorted (x, key=lambda item: (item [1], - item [2])) has a value of (the) ([[1, 3, 3], [2, 3, 1]])

CodePudding user response:

First say is sorted function, the key is equal to the lambda function is a sort of standards, that is, the x sorted by the standards of the lambda provide

93. Sort criteria is the first item (item [0]) and third (item [2]) and, in ascending order, [1, 3, 3] two and=4, two [2, 3, 1) and=3, 3 & lt; 4, so the sorting result for the [[2, 3, 1], [1, 3, 3]]

94, sorting standard: item 2 and 3 of tuples, filling [1] the sort of tuples (3, 3), (2, 3, 1) the sort of tuple is (3, 1), (3, 1) & lt; (3, 3), so the [[2, 3, 1], [1, 3, 3]]

95. Sort criteria: [1, 3, 3) to (3, 3), (2, 3, 1) to (3, 1), (3, 3) is less than (3, 1), so the [[1, 3, 3], [2, 3, 1]]
  • Related