Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_chocolates/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_chocolates/__pycache__/build.cpython-36.pyc
Binary file not shown.
21 changes: 18 additions & 3 deletions q01_chocolates/build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
# %load q01_chocolates/build.py


input_list = []

#input_list = [1,2,5,8]
input_list = [1,2,5,8]
# Write your solution here:


def q01_chocolates(my_list=input_list):


result_list = [] #empty list for number of element
previous_number =0

for element in my_list:
if element % 2 == 1: #condition to test element is odd
previous_number = previous_number + element

result_list.append(previous_number) #append the result

return result_list

q01_chocolates()
l = []
p = [l.append( element)if element%2 ==1 else l.append(l[len(l)-1]) for element in input_list ]



Binary file modified q01_chocolates/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file not shown.