+ 1
input_list =[33,15,27,8,35,42,19,48] def selection_sort (input_list): size = len (input_list) for num in range (0,size-
Sort it in ascending order
2 Answers
0
You can use the built in sort() method which basically sorts any string of elements to alphabetically and it sorts any number element from ascending to descending and vice versa
So
input_list = [2,3,1]
input_list.sort()
print(input_list)
Output = [1,2,3]
To reverse
input_list = [2,3,1]
input_list.sort(reverse = True)
print(input_list)
Output : [3,2,1]
Hope this helps, happy coding!