From 9b38d8c42576811c2f194ef913bcb727b0b55227 Mon Sep 17 00:00:00 2001 From: nikhil-ds Date: Sun, 13 Aug 2017 06:16:38 +0000 Subject: [PATCH 1/2] Done --- .results.json | 1 + pair_sum.py | 16 ++++++++++++++++ pair_sum.pyc | Bin 0 -> 661 bytes tests/__init__.pyc | Bin 0 -> 153 bytes tests/test_pairSum.pyc | Bin 0 -> 1075 bytes 5 files changed, 17 insertions(+) create mode 100644 .results.json create mode 100644 pair_sum.pyc create mode 100644 tests/__init__.pyc create mode 100644 tests/test_pairSum.pyc diff --git a/.results.json b/.results.json new file mode 100644 index 0000000..b70c412 --- /dev/null +++ b/.results.json @@ -0,0 +1 @@ +{"stats": {"passes": 1, "skipped": 0, "encoding": "UTF-8", "errors": 0, "failures": 0, "total": 1}, "results": [{"classname": "tests.test_pairSum:TestPairSum", "type": "success", "name": "test_pairSum", "time": 0.005388975143432617}]} \ No newline at end of file diff --git a/pair_sum.py b/pair_sum.py index e69de29..e669246 100644 --- a/pair_sum.py +++ b/pair_sum.py @@ -0,0 +1,16 @@ +def pairSum(n, number): + if isinstance(n, list): + if len(n) < 2: + return False + pair = [] + i = 0 + for i in range(i, len(n)+1): + for j in range(i+1, len(n)+1): + if number == (i + j): + pair.append((i,j)) + return pair + + + else: + return False +print pairSum([1,2,3,4],5) diff --git a/pair_sum.pyc b/pair_sum.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a7566d4f47dda8b263e7b612de068497bb64e68f GIT binary patch literal 661 zcmb_Z(Q4E{6g`t<*IFqpKDckmkzWMpN#`+rY{f6OR5;X7wH~|cE1)V^r z&>5x~^Z-{0J{;;H%KQO)>x3ZF5^ov)nh<~`QAuq?EML7jlq)xC( z@vTM3uuSi?rWkSh-RY-TKU&wRWOPgSzvmTJoK`}x%rKg9*A~kJ7lZYuvqZL6mo4~A zE{`x_wG5ygaEaz9;-|Zc|TLn)sA|qvMf6N mXIvav@n=Q!aW0b|9}#Yq-IKfxk{&dzUd+wws80_5;r3tG5P$su literal 0 HcmV?d00001 diff --git a/tests/__init__.pyc b/tests/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9a3ecde925f67e2687ac4148e0e8ce06c0a81d4b GIT binary patch literal 153 zcmZSn%*$27)E}A500oRd+5w1*S%5?e14FO|NW@PANHCxg#ZEvm{fzwFRQfgc6r8n_v`rf*7pmS6;$R_#RGce>C=_w2kW;BN60$7shA#C->Rn4zN)M>q z`59dJcl-c&vniAx0G4;W`*!y2ym?9dV>DbwUr!6%Jh6PA%WwoOuR;k_3Nr=8b%ZiP z6=N2o>S5NCXbht;SI|9t0j`15Ss%KOX)=%`_NP3Fl9^u@I5y57Kso)O96wEoB{3zKGTX=r!nd=nd#0^d{LKWU__p2v-q4J;pM^%l8j)6=Ml} zjJUUy^CRr?GsNzWP}Rk2oNzyem&|u?t@x^w`Vo4*kMkkgZ%|5+Gk_F*%c&LKNj1~t zt_VK*%RxG`SUF*7pzRY_qh;qT9kwLdU_A}6L&63@22zp}@q+Wi<0mwP=LXwt`%*IEQ)ZOv*bGULsYC<))mka#K)iTvz(AVZEsm z2_b+xl-cC0sm!Fd=V!JYYd1M*+H<$a3o|JiZ6oGNtMf1eVZ^;GBZcKTy zxb$0+iaWn!w8(7>K*efXjnzm!P& Date: Tue, 15 Aug 2017 02:21:02 +0000 Subject: [PATCH 2/2] Done --- .results.json | 1 - pair_sum.py | 2 +- pair_sum.pyc | Bin 661 -> 701 bytes 3 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 .results.json diff --git a/.results.json b/.results.json deleted file mode 100644 index b70c412..0000000 --- a/.results.json +++ /dev/null @@ -1 +0,0 @@ -{"stats": {"passes": 1, "skipped": 0, "encoding": "UTF-8", "errors": 0, "failures": 0, "total": 1}, "results": [{"classname": "tests.test_pairSum:TestPairSum", "type": "success", "name": "test_pairSum", "time": 0.005388975143432617}]} \ No newline at end of file diff --git a/pair_sum.py b/pair_sum.py index e669246..b770567 100644 --- a/pair_sum.py +++ b/pair_sum.py @@ -13,4 +13,4 @@ def pairSum(n, number): else: return False -print pairSum([1,2,3,4],5) +print pairSum([1,2,3,4,6,7,8,9,10],15) diff --git a/pair_sum.pyc b/pair_sum.pyc index a7566d4f47dda8b263e7b612de068497bb64e68f..97a6866f95a7e2ebb3996a5e952f8b3644da7ddd 100644 GIT binary patch delta 103 zcmbQrx|da&`7Q`T3R86l_7#<1&* KjI5L0naTjY&JAe*