1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vovikov84 [41]
3 years ago
7

Package Newton’s method for approximating square roots (Case Study: Approximating Square Roots) in a function named newton. This

function expects the input number as an argument and returns the estimate of its square root. The script should also include a main function that allows the user to compute square roots of inputs until she presses the enter/return key
Computers and Technology
1 answer:
Shtirlitz [24]3 years ago
7 0

Answer:

def newton(n):

       #Define the variables.

       t = 0.000001

       esti = 1.0

       #Calculate the square root

       #using newton method.

       while True:

               esti = (esti + n / esti) / 2

               dif = abs(n - esti ** 2)

               if dif <= t:

                       break

   

       #Return the result.

       return esti

#Define the main function.

def main():

   

       #Continue until user press enters.

       while True:

               try:

         

                       #Prompt the user for input.

                       n = int(input("Enter a number (Press Enter to stop):"))

                       #display the results.

                       print("newton = %0.15f" % newton(n))

     

               except:

                       return

#Call the main function.

main()

You might be interested in
Which is the best and quickest way for Jim to share his scuba experience with everyone?
iren [92.7K]
Option B

Blog is the best way
7 0
4 years ago
When a security administrator wants to conduct regular test on the strength of user passwords, what may be the best setup for th
wariber [46]
I think it’s letter c
4 0
3 years ago
Which tab of the ribbon includes the links group for creating hyperlinks or internal references?
Deffense [45]
The correct answer is D.File
5 0
3 years ago
Read 2 more answers
Which of the following does not reflect the second step of effective communication?
Ilya [14]

Answer:

c

Explanation:

3 0
3 years ago
Read 2 more answers
What is the provincial capital of lumbini province​
olchik [2.2K]

Answer:

hope it helps..

Explanation:

Butwal(recently changed again) , Rupendhai District

5 0
3 years ago
Other questions:
  • 5. Why would you want to wear white or light colors on a summer day?
    5·1 answer
  • What has prompted schools to add Internet activities in their academic integrity policies?
    11·2 answers
  • Write a program that will predict the size of a population of organisms. The program // should ask the user for the starting num
    6·1 answer
  • Ideally, how often should you back up the data on your computer? once an hour, once a day, once a month, once a year. Please hur
    5·2 answers
  • The first widely adopted windows product, ____, featured a standardized look and feel, similar to the one made popular by apple'
    11·1 answer
  • A client-server relationship is the basic form of a ____?
    15·1 answer
  • What is the voltage drop across R4 in the diagram shown above?
    13·1 answer
  • You wrote a C application that takes 20 seconds using your desktop processor. An improved C compiler is released that requires o
    6·1 answer
  • Can someone that been helping me answer one more question for please and thx
    13·1 answer
  • Ok so I’m using a word document and towards the bottom of the page it stops me from moving my text box any further down even tho
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!