18 lines
369 B
Python
Executable file
18 lines
369 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
|
|
def selectionsort(A):
|
|
if len(A) < 2:
|
|
return A
|
|
for i in range(len(A)):
|
|
for j in range(i + 1, len(A)):
|
|
if A[i] > A[j]:
|
|
A[i], A[j] = A[j], A[i]
|
|
print(A)
|
|
return A
|
|
|
|
if __name__ == "__main__":
|
|
args = [int(x) for x in sys.argv[1:]]
|
|
print(selectionsort(args))
|
|
|