Python Program to Implement Selection Sort

In this program, we will implement selection sort algorithm

  1. #Python program to implement Selection sort
  2. def selection_sort(a):
  3. for i in range(0, len(a) - 1):
  4. first = i
  5. for j in range(i + 1, len(a)):
  6. if a[j] < a[first]:
  7. first = j
  8. a[i], a[first] = a[first], a[i]
  9. a = input('Enter list elements: ').split()
  10. a = [int(x) for x in a]
  11. selection_sort(a)
  12. print('Sorted list: ', end='')
  13. print(a)

Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]

Join Our Facebook Group

Share this example

Download Android App is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube