python-workout
python-workout copied to clipboard
e09b4_even_odd_sums.py should return sum of odd-indexed and even-indexed numbers
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])]