Page 1 of 1

Task 1: Partial Sums Implement a function partial_sum(start, end, step) that takes three integers and returns the partia

Posted: Mon Jul 11, 2022 9:49 am
by answerhappygod
Task 1 Partial Sums Implement A Function Partial Sum Start End Step That Takes Three Integers And Returns The Partia 1
Task 1 Partial Sums Implement A Function Partial Sum Start End Step That Takes Three Integers And Returns The Partia 1 (56.56 KiB) Viewed 36 times
Task 1: Partial Sums Implement a function partial_sum(start, end, step) that takes three integers and returns the partial sum of a sequence. The function will return the sum of the sequence of numbers that starts at start, ends at end (inclusive), and goes up by step. Hint: how can you use a conditional to ensure that end is always included, no matter whether the step is positive or negative? Example: calling partial_sum (3, 13, 2) returns 48 because 3+5+7+9+11+ 13 = 48.