Skip to content

Commit adc008f

Browse files
Merge pull request #2 from H-Darji/master
Improvement
2 parents 90df653 + c5c2fa3 commit adc008f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: SelectionSort.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
print ("Enter numbers seprated by comma ")
21
def selectionsort( aList ):
32
for i in range( len( aList ) ):
43
least = i
54
for k in range( i + 1 , len( aList ) ):
65
if aList[k] < aList[least]:
76
least = k
87

9-
swap( aList, least, i )
8+
aList = swap( aList, least, i )
9+
print(aList)
1010

1111
def swap( A, x, y ):
1212
tmp = A[x]
1313
A[x] = A[y]
1414
A[y] = tmp
15+
return A
16+
17+
print ("Enter numbers seprated by comma ")
18+
response = input()
19+
aList = list(response.split(','))
20+
selectionsort(aList)

0 commit comments

Comments
 (0)