diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..c93236b 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..45d8165 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..6d39e5b 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..617bd9d 100644 --- a/q01_chocolates/build.py +++ b/q01_chocolates/build.py @@ -1,3 +1,4 @@ +# %load q01_chocolates/build.py input_list = [] @@ -6,6 +7,31 @@ def q01_chocolates(my_list=input_list): + #if the pos of list = odd do not consider + #if pos is even, get the number, and add it: + counter = 0 + new_list = [] + if len(my_list)%2==0: + for i in range(len(my_list)): + if i%2==0: + counter +=my_list[i] + new_list.append(counter) + else: + new_list.append(counter) + return new_list + else: + for i in range(len(my_list)): + if i%2!=0: + counter +=my_list[i] + new_list.append(counter) + else: + new_list.append(counter) + return new_list + + + + + diff --git a/q01_chocolates/tests/__pycache__/__init__.cpython-36.pyc b/q01_chocolates/tests/__pycache__/__init__.cpython-36.pyc index 7016538..4d3ed19 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..869e55c 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