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
A software program that includes tools for entering, editing, and formatting text and graphics is called a word processing progr
shtirl [24]

i think the answer is true

7 0
3 years ago
A computer on a network that is not the server​
katrin [286]

Answer:

A peer-to-peer network is one in which two or more PCs share files and access to devices such as printers without requiring a separate server computer or server software. ... A P2P network can be an ad hoc connection—a couple of computers connected via a Universal Serial Bus to transfer files.

5 0
3 years ago
Identify measures to protect your computer against threats from human actions. You cannot access a file in a computer that belon
scZoUnD [109]

Answer:

Firewalls

Explanation:

A firewall is simply a network security system whose main duty is. to prevent unwanted access to. private network.

Firewalls is measures to protect your computer against threats from human actions.

It is also the one singular thing that prevents you from accessing the file on your friends system.

5 0
3 years ago
When an attacker promotes themselves as reputable third-party advertisers to distribute their malware through the Web ads,
pshichka [43]

Answer:

This type of attack is called Malvertising

Explanation:

Malvertising (Malware Advertising)  is a term in computer security that refers to the act of spreading computer malware through online advertisements. It is done by injecting malicious code into genuine online advertisement platforms or malicious webpages that appear as though they are genuine and from reputable third-party advertisers. While it is quite a new concept it is difficult to combact because content for advertisement can be placed in genuine and reputable websites that users trust.

3 0
3 years ago
Whenever I try to take a picture of a question on brainly it says “oops something went wrong try again in a while”. Is anybody h
yuradex [85]

Answer:

yes I am having the same problem I take a picture and it says something is wrong with connection

8 0
3 years ago
Read 2 more answers
Other questions:
  • GenXTech is a growing company that develops gaming applications for military simulations and commercial clients. As part of its
    9·1 answer
  • Write a Java program that generates a new string by concatenating the reversed substrings of even indexes and odd indexes separa
    5·1 answer
  • What function returns a line and moves the file pointer to the next line?
    9·1 answer
  • What is one major difference between the roles of film directors and theater directors? A. A theater director is involved in sel
    14·1 answer
  • Help easy 50 points!!!!<br> How do i make someone be the brianliest? No crown thing is appering!!!!
    10·2 answers
  • If a folder exists on an NTFS partition, which permission is needed by a user who needs to set security permissions on the folde
    11·1 answer
  • R6. Suppose N people want to communicate with each of N - 1 other peo- ple using symmetric key encryption. All communication bet
    13·1 answer
  • Derive an expression for the boolean function L(a,c) whose output is 1 when the light would be on. Note that two of the switches
    9·1 answer
  • c++ 4.17 LAB: Count characters Write a program whose input is a character and a string, and whose output indicates the number of
    14·1 answer
  • ___________ is some danger that can exploit a vulnerability.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!