diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..3a1a537 Binary files /dev/null and b/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_chocolates/__pycache__/__init__.cpython-36.pyc b/q01_chocolates/__pycache__/__init__.cpython-36.pyc index fa1b5bd..bd56aad 100644 Binary files a/q01_chocolates/__pycache__/__init__.cpython-36.pyc and b/q01_chocolates/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_chocolates/__pycache__/build.cpython-36.pyc b/q01_chocolates/__pycache__/build.cpython-36.pyc index 0e64e4d..9156174 100644 Binary files a/q01_chocolates/__pycache__/build.cpython-36.pyc and b/q01_chocolates/__pycache__/build.cpython-36.pyc differ 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 7016538..338d470 100644 Binary files a/q01_chocolates/tests/__pycache__/__init__.cpython-36.pyc and b/q01_chocolates/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_chocolates/tests/__pycache__/test_q01_chocolates.cpython-36.pyc b/q01_chocolates/tests/__pycache__/test_q01_chocolates.cpython-36.pyc index e3c45ac..68ec5be 100644 Binary files a/q01_chocolates/tests/__pycache__/test_q01_chocolates.cpython-36.pyc and b/q01_chocolates/tests/__pycache__/test_q01_chocolates.cpython-36.pyc differ