diff options
Diffstat (limited to 'bubble-sort.py')
-rwxr-xr-x | bubble-sort.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bubble-sort.py b/bubble-sort.py new file mode 100755 index 0000000..431a6f2 --- /dev/null +++ b/bubble-sort.py @@ -0,0 +1,27 @@ +#!/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) + +# bubble sort operation +for i in range(len(numdata)): + for j in range(0,len(numdata)-i-1): + if numdata[j] > numdata[j+1]: + numdata[j], numdata[j+1] = numdata[j+1], numdata[j] + +# finishing up +print("writing to file") +io.egressCSV(numdata,target) |