- 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 35 times
Task 1: Partial Sums Implement a function partial_sum(start, end, step) that takes three integers and returns the partia
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Task 1: Partial Sums Implement a function partial_sum(start, end, step) that takes three integers and returns the partia
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.