Ordenar por maximo en Python
This commit is contained in:
15
src/Python/002.py
Normal file
15
src/Python/002.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
def order_by_max(lst: list) -> list:
|
||||||
|
return sorted(lst, key=max)
|
||||||
|
|
||||||
|
|
||||||
|
check = [[3,2],[6,7,5],[1,4]]
|
||||||
|
print(order_by_max(check)) # [[3,2],[1,4],[6,7,5]]
|
||||||
|
|
||||||
|
check = [[1],[0,1]]
|
||||||
|
print(order_by_max(check)) # [[1],[0,1]]
|
||||||
|
|
||||||
|
check = [[0,1],[1]]
|
||||||
|
print(order_by_max(check)) # [[0,1],[1]]
|
||||||
|
|
||||||
|
check = ["este","es","el","primero"]
|
||||||
|
print(order_by_max(check)) # ["el","primero","es","este"]
|
||||||
Reference in New Issue
Block a user