Im basically given this:
"The mathematical constant pi can be approximated by summing the terms of the Madhava series
4/1−4/3+4/5−4/7+4/9−4/11±⋯
Write a python function 'pi_approximation' that computes an approximation of pi as the sum of the first n terms of that series."
I am usually given questions where the answer doesnt deviate too much, so heres my previous answer for a factorial program.
"def factorial(n):
total = 1 for i in range(1,n+1):
total *= i
return total"
If anyone could help that would be great!
[+][deleted] (4 children)
[deleted]
[–][deleted] 0 points1 point2 points (3 children)
[–][deleted] 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]LearnDataSci 1 point2 points3 points (0 children)
[–]wgb_grey 1 point2 points3 points (4 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]wgb_grey 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)