Question
# Question 1: start def Leibniz_sum(n): Write the code for the function, and check using test cases below to make sure that it's correct.
# Question 1: start def Leibniz_sum(n): """ Write the code for the function, and check using test cases below to make sure that it's correct. You will use this function to answer the remaining part of Question 1 in the next cell.""" # test cases to try out print(Leibniz_sum(0)) # should print 4.0 print(Leibniz_sum(20)) # should print 3.189184782277596 print(Leibniz_sum(1000)) # 3.1425916543395442
# Question 1: continued # Using the function Leibniz_sum(n) # write code to find n and the corresponding approximation of pi # # for this part, you can either write a function, or just write # plain code, up to you. # the output should consist of two values - the value of n and the # corresponding approximation of pi import math # insert your code here
[1]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started