Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part II: Additional Hand-Written Exercises 1. State whether you think it would b

ID: 645940 • Letter: P

Question

Part II: Additional Hand-Written Exercises 1. State whether you think it would be easier to solve the problem below using a for loop or a while loop, and explain why. DO NOT WRITE ANY CODE. Instead, think about how you would solve the problem, then simply indicate whether you would choose for or while, and why. Using the infinite series Pi^2=6(1/1^2+ ½^^2+ 1/3^2+ ¼^2+...) compute an approximation of TI that is accurate to a specified number of decimal positions by adding ever more terms to the series until the square root of the series is within 0.0000001 of Pi. (2pts)

Explanation / Answer

In this case, I'd prefer while loop as we don't know the number of terms in the series(we have to check the difference between 2 consecutive sums to get the desired answer with minimal error)

But, we can use for loop too, though I'd not prefer it personally!