Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.
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.
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.
Function Parameters | Expected Output |
---|---|
5 | 2 |
6 | 2 |
7 | 3 |
Submissions for post labs are to be done via the inquire system. Go to http://inquire.roanoke.edu/ You should see a section for post labs. Submit your .py file to the appropriate post lab location.
Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.