Question: Definea new function called mySqrt with one formal parameter defined in the parameter list. The parameter represents the number of which you will find the
Definea new function called mySqrt with one formal parameter defined in the parameter list. The parameter represents the number of which you will find the square root, you can call it n if you want.Include the input, output, and process below as docstrings in your function. You can use the parameter names provided above or pick your own. I listed them so that it would be easier to reference them in the text below. Newtons approach is an iterative guessing algorithm where the initial guess is n/2 and each subsequent guess is computed using the formula: newguess = (1/2) * (oldguess + (n/oldguess)).
1. Write the code to calculatethe initial guess andassignit to a variable called square_root.
2. Setup your for-loop header. As the number of times you iterate increases, the closer your approximation. I iterated 100 times in my solution. 2(a). Calculate the subsequent guesses using the formula: (1/2) * oldguess + (n/ oldguess). Use the update pattern with the square_root variable to store the values.
3. Return the square root.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
