From 2846699dcdc476f11e73f29b22921db050bc4d55 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 15 Nov 2018 15:21:37 -0500 Subject: [PATCH] Commited to Branch 1 --- __pycache__/test.cpython-36.pyc | Bin 0 -> 1317 bytes test.py | 26 ++++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 __pycache__/test.cpython-36.pyc diff --git a/__pycache__/test.cpython-36.pyc b/__pycache__/test.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c2810e479a44f5650cca8bf6c6e15e53bb70da31 GIT binary patch literal 1317 zcmZ8hTWcgm6t1eiOiw$jYjhVCgkBJ2U=5hvCt22oLYrX5aVG-{7l1r(S&u{sW&pr+SkNR#V?Obvc(hmws~ZUi#M`|NQziB;;?hHDFC% zz%*X~NFr%P@}AP1eorKm!5bn2#Wq16NP0-d;WgYOlLGN(FkoK5^jZ|jsU$g*RI)b& zqyiZN4P_)_pphJamc$K@l(GAjFs48!a3Doh`!LNzfR1*Ala2w>E&ybbfH0km0~gGj z#sxE>5!!L+LZhm=4nRz!A{_zzN%R27zkB=NOn){?o2fZ1FU0hqDOP8ywq|L%%Q~5*0ss1j*>kk?f$JfG zJI?FmsAdF9b02`v`*Z|f%2JQ*M|Y7yv;OvNXoev0Axs~d-+{4^-wl16tpiIJ3?H=) zF;rEsj=E?OZU`mtMD`PTNq)iGP>dV)_W3%t(IW039P2?hSPVLl`jjk^4Z*Oy{;Ufj z)I00MpCyZ7zkfbG-qI!+mU6qmLS*fgOYAYb?^$F}$rLkEv&*qh|*$;<5 zPO@gUP=z&_ZQ!^t7rSYiy&K1;!hUIB`=BiBu`aFBkF%?0l^JpMZ8lM0B|B9@OVn7} zM|YAwWfMm)$EgdOrK(-HFb!bU2{5@b}`+iJV5+x(Q2bKH)&(SXz_j&RMTME2BU(3m}-h=1ZEe3lwp-J!` DydgRm literal 0 HcmV?d00001 diff --git a/test.py b/test.py index 7c0ef3c..a0f04df 100644 --- a/test.py +++ b/test.py @@ -13,19 +13,25 @@ def fizz_buzz(self, digit_1, digit_2): for i in range(1, 100): if i % digit_1 == 0: if i % digit_2 == 0: - print 'fizzbuzz!' + print ('fizzbuzz!') else: - print 'fizz!' + print ('fizz!') elif i % digit_2 == 0: - print 'buzz!' + print ('buzz!') else: - print i + 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) @@ -34,3 +40,7 @@ def json_to_csv(self, json_file_path, outfile_path): writer.writerow(data[0].keys()) for item in data: writer.writerow(item.values()) + +if __name__ == '__main__': + t = TestClass(1, 2, 3) + t.fizz_buzz(3, 5) \ No newline at end of file