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
Olegator [25]
3 years ago
7

Package Newton’s method for approximating square roots (Case Study 3.6) in a function named newton. This function expects the in

put 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:
notka56 [123]3 years ago
8 0

Answer:

import math

#Initialize tolerance

tolerance = 0.000001

def newton(x):

   """ Returns the square root of x """

   #Performs the successive approximations

   estimate = 1.0

   while True:

       estimate = (estimate + x / estimate) / 2

       difference = abs(x - estimate ** 2)

       if difference <= tolerance:     # Break out of loop if difference is less than tolerance

           break            

       return estimate     # While the difference value is > TOLERANCE, the process continues

def main():

   """Allows the user to obtain square roots."""

   while True:

       #Receive the input number from the user

       x = input("Enter a positive number or enter/return to quit: ")

       if x == "":     #if user presses "Enter" then exit the program

           break       # Otherwise, continue the process of allowing new numbers

       x = float(x)

       #Output the result

       print("The programs estimate of the square root of ", x, "is ", round(newton(x),2))

       print("Python's estimate: ", math.sqrt(x))

main()

You might be interested in
Nonverbal messages from the movie it​
RUDIKE [14]

Answer:

ya you say right

Explanation:

5 0
3 years ago
Read 2 more answers
Kumar was working on his term paper and had not saved his work before the battery died on his laptop. He panics because the pape
Nina [5.8K]

Answer:

By presuming Kumar was working on his term paper using Microsoft Word, he can be advised to restore the unsaved document using the Recover Unsaved Documents feature in Word.

Explanation:

Firstly, Kumar can click File tab in Word and click Manage Document. Kumar shall find the option Recover Unsaved Documents from a drop down list and he can click it as his option. At this stage, Kumar shall see the missing files in the dialog box. The recent loss file shall appear in the dialog box. Just open the desired document and save it.

4 0
3 years ago
A customer dictates instruction on how to transcribe audio. Do you have to transcribe the instruction word for word?
Ostrovityanka [42]

Answer:

No

Explanation:

4 0
2 years ago
n a​ poll, 6767​% of Internet users are more careful about personal information when using a public​ Wi-Fi hotspot. What is the
a_sh-v [17]

Answer:

The probability that among three randomly selected Internet​ users, at least one is more careful about personal information when using a public​ Wi-Fi hotspot is 0.964

If the survey subjects <em>volunteered</em> to​ respond , then those with the strongest opinions are most likely respond. The survey sample is then not randomly selected, the survey may have a <em>response bias.</em>

Explanation:

Let P(at least one is more careful about personal information when using a public​ Wi-Fi hotspot) denote the probability that among three randomly selected Internet​ users, at least one is more careful about personal information when using a public​ Wi-Fi hotspot, then we have the equation

P(at least one is more careful about personal information when using a public​ Wi-Fi hotspot) = 1 - P(none of the selected users is more careful about personal information when using a public​ Wi-Fi hotspot)

  • If 67​% of Internet users are more careful about personal information when using a public​ Wi-Fi, then 33% of them are not.

P(none of the selected users is more careful about personal information when using a public​ Wi-Fi hotspot) = 0.33^{3} ≈ 0.036

P(at least one is more careful about personal information when using a public​ Wi-Fi hotspot)  = 1 - 0.036 = 0.964

4 0
2 years ago
When conducting research on the internet, what is a starting point for determining how to start the research?
Alex787 [66]
It depends on what you're researching for.
4 0
3 years ago
Other questions:
  • The fundamental difference between a switch and a router is that a switch belongs only to its local network and a router belongs
    10·1 answer
  • When creating a spreadsheet, there's no need to worry about design and how it will be organized; the program will take care of t
    11·2 answers
  • Outlines are effective because
    13·2 answers
  • Briefly summarize two examples of cybercrime stories.<br> quick pleaseeee
    10·1 answer
  • Jeremy Aronoff has purchased a new laptop. He wants to customize the operating system to meet his
    7·1 answer
  • A collection of realated files is called a
    12·1 answer
  • Henry must choose which type of smart speaker to use in his home. He asked you to help him decide which one will best suit his n
    8·1 answer
  • ____ Is an Internet service that allows users to send and receive short text messages In real time.
    10·1 answer
  • Which skill type refers to the ability to interact and communicate effectively with people? skills refer to the ability to inter
    8·2 answers
  • In Tynker, it is not possible to create a/an __________.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!