211c28c340
* added new python exercise and solution * add sort exercise and solutions * changed heading1 * fixed header description
598 B
598 B
Sort Descending - Solution
-
write a function that sorts the following list of list without using the
sorted()
and.sort()
function in descending order- mat_list = 1, 2, 3], [2, 4, 4], [5, 5, 5 -> 5, 5, 5], [2, 4, 4], [1, 2, 3
def sort_desc(mat: list) -> list:
""" Sorts a list in descending order
Args:
mat (list): paresd list
Returns:
list: A new list
"""
new_list = []
while mat != []:
maxx = max(mat)
new_list.append(maxx)
mat.remove(maxx)
return new_list
print(sort_func(mat_list))