From 6e42648ae970f257db98d230dd43021bd04a8535 Mon Sep 17 00:00:00 2001 From: Baigel <43929690+Baigel@users.noreply.github.com> Date: Fri, 25 Oct 2019 11:42:54 +1000 Subject: [PATCH] Create Selection_Sort.py --- SortingAlgorithms/Selection_Sort.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 SortingAlgorithms/Selection_Sort.py diff --git a/SortingAlgorithms/Selection_Sort.py b/SortingAlgorithms/Selection_Sort.py new file mode 100644 index 0000000..94d585c --- /dev/null +++ b/SortingAlgorithms/Selection_Sort.py @@ -0,0 +1,10 @@ +""" Python3 Selection Sort """ + +unsorted = [1,54,2,34,23,3,23,32,5,34,2,23,235,324,6,43] + +sorted = [] +for i in range(len(unsorted)): + sorted.append(min(unsorted[:])) + unsorted.remove(min(unsorted[:])) + +print("Sorted Array:", sorted)