diff --git a/test.py b/test.py index 7c0ef3c..d04f160 100644 --- a/test.py +++ b/test.py @@ -21,11 +21,17 @@ def fizz_buzz(self, digit_1, digit_2): else: print i - def json_to_csv(self, json_file_path, outfile_path): - """Convert a file containing a list of flat JSON objects to a csv. - - What's a DictWriter, you say? Never heard of it! + def bubble_sort(self, alist): + length = len(alist) - 1 + for i in range(0, length): + if alist[i] > alist[i + 1]: + # alist[i], alist[i+1] = alist[i+1], alist[i] # python way + temp = alist[i] + alist[i] = alist[i + 1] + alist[i + 1] = temp + def json_to_csv(self, json_file_path, outfile_path): + """DictWriter has saved my life!!! """ with open(json_file_path) as f: data = json.load(f)