Python:
Write a function called sum_odd that takes two parameters, then calculates and returns the sum of the odd numbers between the two given integers. The sum should include the two given integers, if they are odd. You can assume the arguments will always be positive integers, and the first smaller than or equal to the second.
To get full credit on this problem, you must define at least 1 function, use at least 1 loop, and use at least 1 decision structure.
Examples:
sum_odd(0, 5) should return the value 9 as (1 + 3 + 5) = 9
sum_odd(6, 10) should return the value 16
sum_odd(13, 20) should return the value 64
sum_odd(7, 11) should return the value 27
Get Answers For Free
Most questions answered within 1 hours.