From 33027438ddf43324ea1a80df1827e69d24de3edd Mon Sep 17 00:00:00 2001 From: abkedar Date: Fri, 28 Sep 2018 14:07:12 +0000 Subject: [PATCH] Done --- __pycache__/__init__.cpython-36.pyc | Bin 0 -> 161 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 179 -> 176 bytes .../__pycache__/build.cpython-36.pyc | Bin 463 -> 556 bytes q01_chocolates/build.py | 22 ++++++++++++++---- .../tests/__pycache__/__init__.cpython-36.pyc | Bin 185 -> 182 bytes .../test_q01_chocolates.cpython-36.pyc | Bin 1762 -> 1759 bytes 6 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 __pycache__/__init__.cpython-36.pyc diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3a1a5376d24c0bf1a79b9b74e17e69325792a341 GIT binary patch literal 161 zcmXr!<>gW|T^G&Bz`*brh~WSv-~hzMEI=ZKA(%mv(QhR~5l9$8{PNS!$j?pHPfW^A zO-U@$56>^kE-pw+PSsD&Pf68JD@sf*Nz94QNKDR7Eh%*jd3 kOHYkA){l?R%*!l^kJl@xyv1RYo1apelWGUDrx=JC0OH~*3IG5A literal 0 HcmV?d00001 diff --git a/q01_chocolates/__pycache__/__init__.cpython-36.pyc b/q01_chocolates/__pycache__/__init__.cpython-36.pyc index fa1b5bddbc8c351ed512c69f150537017faac69f..bd56aad04ebf5115c178a28f9848022fb8d1baaa 100644 GIT binary patch delta 49 zcmdnYxPg(wn3tDJ(R5w(L=JP=SpAIr+*JLa-`7l^n9;tCvr z-fb#hfr{Bw8EL+G=pW5!exon>dX=Wh#m)CaBmnksWHIM+c7M$vAS}V)Aqo?bpok3P=DDcC$Cp;_hdDKIYz^$zPhv z=Ec+6Qqku3O}qB4SlWEqko~;G#g?bQPZ%I1N-@C=;>o$+&%5M(JHf%h?8JE4DRSk8ez2%31565cMB2zm32d@D==Kufz delta 211 zcmZ3(a-P}7n3tDJ^USNL3`Pcq#|%h-8OU}3;$jgXkzi7CbU8Hvf+sYOMJdD)Xw z8U12GDvO1H1OpQbBMXxdqW~ih6A&}OV diff --git a/q01_chocolates/build.py b/q01_chocolates/build.py index ed96c95..7225dd9 100644 --- a/q01_chocolates/build.py +++ b/q01_chocolates/build.py @@ -1,12 +1,26 @@ +# %load q01_chocolates/build.py +import pandas as pd +import numpy as np - -input_list = [] - +input_list = [3, 4, 5, 8, 9, 10] +#input_list = [2, 5, 8, 11, 4] # Write your solution here: -def q01_chocolates(my_list=input_list): +def q01_chocolates(my_list): + val = 0 + final_list = [] + for i in range(len(my_list)): + if my_list[i] % 2 == 0: + final_list.append(val) + else: + my_list[i] % 2 != 0 + val += my_list[i] + final_list.append(val) + return final_list +q01_chocolates(input_list) +#np.cumsum(input_list) diff --git a/q01_chocolates/tests/__pycache__/__init__.cpython-36.pyc b/q01_chocolates/tests/__pycache__/__init__.cpython-36.pyc index 701653826940ef168f2717fd45f0e007bf3a5eb7..338d470999bbd6a5321fb7f38d99b0265fa2d979 100644 GIT binary patch delta 49 zcmdnVxQ&s+n3tDJ#dKZtL=JP=Wc`f%+*JL{M=Oi#H8%hl*A(a@cg3e;)2BFRQ=@ql+?|R HObb~6s=W~q delta 55 zcmcc5`-qprn3tDJ^USNLjU19p3WfR^`MIh3iAfom`Y!q9c{%xsDaHC3iOJciMMa5u L*_-W{7P0^U2AvZx