Add Chapter 6 python files and fix grammar issues in readme

This commit is contained in:
lolabird 2023-09-17 08:08:06 -06:00
commit bcb2885eeb
15 changed files with 422 additions and 3 deletions

View file

@ -0,0 +1,20 @@
# Runestone.Academy thinkcspy course
# Chapter 6
# Problem 16
import math
def myPi(iters):
# Calculate an approximation of PI using the Madhava
# approximation with iters number of iterations
#your code here
apprPi = 0
for i in range(iters):
term = (-1)**i/((2*i+1)*3**i)
apprPi += term
return apprPi * math.sqrt(12)
print(myPi(10))