blob: c41c86ec006a730bf20ee25240a8749a6615378c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/python3
# ---------- title
# ---------- Imported modules
import inputoutput as io
import csv
import sys
# ---------- Main
target = sys.argv[1]
# ingress of data
numdata = io.ingressCSV(target)
# selection sort algorithm
for i in range(len(numdata)):
mindex = i
for j in range(i+1, len(numdata)):
if numdata[mindex] > numdata[j]:
mindex = j
# updating values - trying without simulatenous assignment
numdata[i], numdata[mindex] = numdata[mindex], numdata[i]
# finishing up
print("writing to file")
io.egressCSV(numdata,target)
|