Question: use python to solve this problem Problem 2 - balls.py: Pool ball arrangements [5 points] Write a function ball_rows ) which takes a non-negative integer

use python to solve this problemuse python to solve this problem Problem 2 - balls.py: Pool ball

Problem 2 - balls.py: Pool ball arrangements [5 points] Write a function ball_rows ) which takes a non-negative integer argument n and returns the number of rows necessary for n pool balls in a standard arrangement The standard arrangement has 1 ball on the first row, two on the second, three on the third, and so on row row-balls balls-so-far 45 6 78 9 10 11 12 13 14 15 10 15 21 4 4 16 17 18 19 20121) 6 For example, the figure above illustrates the case of n = 18, which corresponds to a return value of 6 Hint This is exactly the calculation of 1+2+3+ + m, which was our first ever loop. Only the termination condition is different, which now is with respect to the sum. Although there are other ways to go about the details of the implementation, if you're stuck, you might want to start by re-implementing our first loop using while and then modifying that (textually, it's a very small modification)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!