Write a progarm to sort the list in assending order


Topic: Write a progarm to sort the list in assending 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'assending_order_list: {new_list}')



List all Python Programs