Skip to content

Commit bf9d039

Browse files
fix: corrected the total of positive integers in issue 4 (#100)
1 parent 8407fe5 commit bf9d039

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎python-open-source-challenge/issue-04.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313

1414
def positive_sum(values):
1515
# TODO: Check how the running total should start.
16-
total = 1
16+
total = 0
1717

1818
# TODO: Check whether the first list item is skipped.
19-
for value in values[1:]:
19+
for value in values[0:]:
2020
# TODO: Check the boundary used to select positive values.
2121
if value >= 0:
2222
# TODO: Check how each qualifying number changes the total.
23-
total = value
23+
total += value
2424

2525
# TODO: Check which result is returned to the caller.
26-
return values
26+
return total
2727

2828
def check_solution():
2929
assert positive_sum([-2, 3, 0, 5]) == 8

0 commit comments

Comments
 (0)