Write a program to sort the list in desending order


Topic: Write a program to sort the list in desending order

Solution

data_list = [-5, -23, 5, 0, 23, -6, 23, 67]
new_list = []
while data_list:
    minimum = data_list[0]  # arbitrary number in list 
    for x in data_list: 
        if x > minimum:
            minimum = x
    new_list.append(minimum)
    data_list.remove(minimum)    
print(f'decending_order_list: {new_list}')



List all Python Programs