From c5c2fa3b9d3dc5361960ef299206068a5780e09b Mon Sep 17 00:00:00 2001 From: Harshil Darji Date: Thu, 28 Jul 2016 22:33:24 +0530 Subject: [PATCH] Improvement --- SelectionSort.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SelectionSort.py b/SelectionSort.py index 89b6977cb..91f46b80a 100644 --- a/SelectionSort.py +++ b/SelectionSort.py @@ -1,4 +1,3 @@ -print ("Enter numbers seprated by comma ") def selectionsort( aList ): for i in range( len( aList ) ): least = i @@ -6,9 +5,16 @@ def selectionsort( aList ): if aList[k] < aList[least]: least = k - swap( aList, least, i ) + aList = swap( aList, least, i ) + print(aList) def swap( A, x, y ): tmp = A[x] A[x] = A[y] A[y] = tmp + return A + +print ("Enter numbers seprated by comma ") +response = input() +aList = list(response.split(',')) +selectionsort(aList)