The Leibniz formula is a way of calculating the value of pi. Per Wikipedia: Write a program in Python that contains a function which calculates pi per the Leibniz formula, based on the number of...


The Leibniz formula is a way of calculating the value of pi. Per Wikipedia:



Leibniz.png


Write a program in Python that contains a function which calculates pi per the Leibniz formula, based on the number of values passed to it. The rest of the program should:





    1. prompt the user for input,

    2. call the function, and

    3. print the value of pi based on the user’s input. (The correct answer is 3.058402765927333 when the user enters 12.)




Be sure to:





    1. follow the style guide and use comments as appropriate,

    2. include exception handling for incorrect user responses, and

    3. allow the user to execute the program multiple times without exiting it.




Please use your name and “Homework1” as the title of your program, for example SweeneyHomework1.py.

Aug 22, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here