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

Do the one which is highlighted.....No one did it correctly till now.. so plz if

ID: 3798658 • Letter: D

Question

Do the one which is highlighted.....No one did it correctly till now.. so plz if u know then u do.also for pie attributes..like..radius...circumference..area...volume of sphere...s

The Leibniz formula is a way of calculating the value of pi. Its definition in Wikipedia is:

Write a program in Python that contains a function which calculates pi. per the Leibniz formula.

The program must use that function to calculate and print the value of pi based on the first 12 values. (The correct answer is 3.058402765927333.) Be sure to include a header block and to use comments in your program.

Modify the program, so that it contains a class related to the Leibniz formula. Add additional methods to the class (Except functions ) for doing calculations based on the pi attribute. Divide your program into two modules - one which contains your class and another which demonstrates the class methods. Enable a user to enter the number of values to be used in the pi calculation. Be sure your program contains exception handling and has been debugged. It should also launch and be usable under Windows 10

In mathematics, the Leibniz formula for T, named after Gottfried Leibniz, states that 1 1 1

Explanation / Answer

def estimate_pi( iteration ):

sign , pi = 1,0.0

for n in range ( iteration ):

pi += 4/(n*2+1)*sign

#multiply by sign for a+ or - answer

sign *=-1

#alternate sign as 1 or -1

return pi

print("how many iteration?")

print(estimate_pi(int(input())))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote