python-workout
python-workout copied to clipboard
Fix e09b4_even_odd_sums.py to match text problem and add related UT
Text problem says: Write a function that takes a list or tuple of numbers. Return a two-element list, containing (respectively) the sum of the even-indexed numbers and the sum of the odd-indexed numbers. So calling the function as even_odd_sums([10, 20, 30,40,50,60]), you’ll get back[90,120].
Current solution does not look at index; rather looks at whether number itself is odd or even.
I agree with this, the solution is not using slides. This change is quite good, slides are used here.