In this post-lab you will demonstrate your understanding of while loops by writing a function that uses a while loop to solve a mathematical problem.
Details
Create a function called summation_less_than(max_sum)
in a filed called summation.py. This function should
return the largest number of sequential integers that sum to less
than the specified positive integer max_sum
. Put
another way, return the \(n\) such that:
$$(\sum_{i=0}^n i) < max\_sum$$
Make sure you have sufficient test cases and that you follow all of the course's coding conventions.
Sample Test Cases
Function Parameters | Expected Output |
---|---|
5 | 2 |
6 | 2 |
7 | 3 |
Submission
Submit your program as a .py file on the course Inquire page before class on Monday October 6th.