My sorting algorithm doesn't function due to unknown reason

I’m trying to create a sorting algorithm, it contains a nested loop which compares each element of the array to all other elements in the array, and if an element is greater in value than any of its succeeding elements, they switch places with each other. But for some reason my program won’t output anything… Read More My sorting algorithm doesn't function due to unknown reason

This code is about Selection sorting but when i run the code it is not working as expected

The program only works when the no. of elements is 2 if it is more than 2 it doesn’t work. #Selection Sort L = [] n = int(input(‘Enter the number of elements\t:’)) for i in range(n): item = int(input(‘Enter item\t:’)) L.append(item) print(‘List\t:’) for i in range(n-1): for j in range ((i+1),n-1): if (L[j]<L[i]): (L[j],L[i]) =… Read More This code is about Selection sorting but when i run the code it is not working as expected