From 28b1f7c5cce716e591d6e4bce23d7f1b5d6d06d1 Mon Sep 17 00:00:00 2001 From: adinathauti Date: Thu, 15 Jun 2017 17:44:34 +0000 Subject: [PATCH 1/2] Done --- .results.json | 1 + pair_sum.py | 10 ++++++++++ pair_sum.pyc | Bin 0 -> 599 bytes tests/__init__.pyc | Bin 0 -> 163 bytes tests/test_pairSum.pyc | Bin 0 -> 1105 bytes 5 files changed, 11 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..bca299a --- /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.0003859996795654297}]} \ No newline at end of file diff --git a/pair_sum.py b/pair_sum.py index e69de29..5713107 100644 --- a/pair_sum.py +++ b/pair_sum.py @@ -0,0 +1,10 @@ +def pairSum(l,n): + sum = [] + for i in range(0,len(l)): + for j in range(0,len(l)-1): + if(l[i]+l[j]==n): + sum.append((l[i],l[j])) + return sum + +tst = pairSum([1,2,3,4],5) +print tst diff --git a/pair_sum.pyc b/pair_sum.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab06d38e2dd17f1c5c3c459aaef21792370331cb GIT binary patch literal 599 zcmb`D&q~8U5XQev(pp8&w%CIw$t4E#8bnmoQxEnKEQp5gw%xY*)9w~4q^J6BK9Dcq z%pwRq8#3SS>^GVDW&Q7?gUhd*=OKQd2Cdf=CL)o*ColjM?FFO<=|ct>2apYHJq!et zz{8_#q95+j7ekMPdo(F-DGW8h7}$7Nzr(sdR-gv9f;-&3ykX;Go$h)xtnK^+n}F+U zA01u-bdGC*nTKV9+QZb_aYr8a7K;S*ri(68s_KV6f%G&9v>jFn}3t_sWG zSyib*hHMfmojWaDjalU`(@v)$*>Ga+X%|n*T*aBxMP?`2%IY{RmormkLlqB8sp655 zMn%nC8KcKVPE(_cxXSeMmAapk$ydpFf0grmb4UWw6kTyD+Tu*OKhS*Fnz?nr j!nnPV51(2jj@BCcNBHlUJSNFYxtgmh$H^S~trPJB-=B6~ literal 0 HcmV?d00001 diff --git a/tests/__init__.pyc b/tests/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c11d09fc8fea97bea42b17618277c7408913497d GIT binary patch literal 163 zcmZSn%*(arkW*wb0~9aBk zG7?KmGWEmri?WLg5|dN)lk-zj_0x(|ic@t9DoZl*^K=u7i!;;na#Qn4bdB^&Qj1H9 h_2c6+^D;}~?5<|9)5VU&r1k-o z|H8|D1%HVj0Qb6u@dqG^PweaC>vPX-;~#_m?f2u065A)H?<*RPLDDNw0Y+ddAb1_2 zieO?)W0(%69g4G!B=1nTui%=U5t|+CDA|WNd(ROF2T8S{-kg!i8%6rz}ES! zwWZg!&1ZFMrQe~bYs*q8>G!v1&I;X(Tk}UKCp=~zr%+&hB#-W&M##qDzLGf|8l2;V zhPx%W`NBnU9igrj)wQH`%<@UJ>_P58?n3TC_96F~eMyr8tRt)kwCiV$BzKg3qnr{$7FsBD9`i^4-K2SB| zL{mVgiX0dTXvw^zHz%^>_oMwkLlXS424bXjtJq8-cn4B;#w1bo7t~DVX%r2Z$ zjem397M16toAr6qsw}jO&3tbbHF27Tkk=c|+oEzR<2w_+gsLXXRW;k>WvU2#S8h?1DlKcN(wUP^jTSe4UfU7fsV}Wj){ma2 zo_V7|5I8PN_XDewG_u~}|N01=C!7>R*+Bn}A^HZS;*=e95^&qL{XZfe<9w9E!X zxRd+uG-s?N7{_M!#A)~s1!=9-o~y}d1D@?v+yECG54{P8|A)$;=f%dHm)vm2l8549 F^b5x-@x}lE literal 0 HcmV?d00001 From fb3ef5af79e7c482b9ee432d740aebc4cb6bd5ad Mon Sep 17 00:00:00 2001 From: adinathauti Date: Fri, 16 Jun 2017 04:05:36 +0000 Subject: [PATCH 2/2] Done --- .results.json | 1 - pair_sum.py | 2 +- pair_sum.pyc | Bin 599 -> 590 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 bca299a..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.0003859996795654297}]} \ No newline at end of file diff --git a/pair_sum.py b/pair_sum.py index 5713107..ea57507 100644 --- a/pair_sum.py +++ b/pair_sum.py @@ -1,7 +1,7 @@ def pairSum(l,n): sum = [] for i in range(0,len(l)): - for j in range(0,len(l)-1): + for j in range(0,len(l)): if(l[i]+l[j]==n): sum.append((l[i],l[j])) return sum diff --git a/pair_sum.pyc b/pair_sum.pyc index ab06d38e2dd17f1c5c3c459aaef21792370331cb..57cfdc85008f08315af78e4fa1326627ffe3be80 100644 GIT binary patch delta 112 zcmcc4a*lC!;B@7HHj0`1=3^fc4&5R7qObjlu zF$}fL3>CrXaueq%Fj`F9FDqujP-wvrUMRy5UcD=JB@7HHj0`1=3^fc4&5R7qObjlu z2@JK&3>D$%aw$v<5))@BFxpJqEh}xqP-w#tUMRy5Uc