python-workout icon indicating copy to clipboard operation
python-workout copied to clipboard

e09b4_even_odd_sums.py should return sum of odd-indexed and even-indexed numbers

Open khoi-thinh opened this issue 4 years ago • 0 comments

The solution on github returns sum of old and even numbers which is not in line with the idea in the book.

The code can be like:

def ex9_ch4(list):
    return [sum(list[0::2]), sum(list[1::2])]

khoi-thinh avatar Apr 19 '21 01:04 khoi-thinh