Question 3 [35 marks] Write a program called 'pi.py' that calculates the value of PI and then computes and displays the area of a circle with radius entered by the user. PI must be approximated using the following formula. Note that this formula has an infinite number of terms with increasing complexity, so you must multiply additional terms until the size of the next term is 1! $2 imes frac{2}{sqrt{2}} imes frac{2}{sqrt{2 + sqrt{2}}} imes frac{2}{sqrt{2 + sqrt{2 + sqrt{2}}}}$ Hint: This problem requires the use of a 'while' loop to accumulate each term. Also, use the round function to display the computed values with 3 decimal places e.g. round(5.23517, 3) is 5.235. Sample I/O: Approximation of pi: 3.142 Enter the radius: 2.5 Area: 19.635 Submission
Added by Katelyn Z.
Close
Step 1
141592653589793. To calculate the area of a circle with radius 2.5, we use the following formula: Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 100 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a program in Python to calculate and print the circumference and area of a circle
Haricharan G.
Approximating Area $\quad$ Consider the circle $r=8 \cos \theta$ (a) Find the area of the circle. (b) Complete the table giving the areas $A$ of the sectors of the circle between $\theta=0$ and the values of $\theta$ in the table.$$ \begin{array}{|c|c|c|c|c|c|c|c|} \hline \boldsymbol{\theta} & 0.2 & 0.4 & 0.6 & 0.8 & 1.0 & 1.2 & 1.4 \\ \hline \boldsymbol{A} & & & & & & & \\ \hline \end{array} $$(c) Use the table in part (b) to approximate the values of $\theta$ for which the sector of the circle composes $\frac{1}{4}, \frac{1}{2}$, and $\frac{3}{4}$ of the total area of the circle. (d) Use a graphing utility to approximate, to two decimal places, the angles $\theta$ for which the sector of the circle composes $\frac{1}{4}, \frac{1}{2}$, and $\frac{3}{4}$ of the total area of the circle. (e) Do the results of part (d) depend on the radius of the circle? Explain.
Adi S.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD