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
Transitive spread refers to the effect of the original things transmitted to the associate things through the material, energy o
Ludmilka [50]
A is the correct answer
4 0
3 years ago
What is the full path of the directory on this computer containing the SAM registry hive file
kompoz [17]

Windows 2000 only supported standard format. It is group of legitimate keys, subkeys, and important in the registry that supports the files and contains backups of its data is called registry.  On versions of Windows that support the latest format, the following hives still use the standard format: HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE\SAM, HKEY_LOCAL_MACHINE\Security, and HKEY_USERS\.DEFAULT; all other hives use the latest format.

3 0
3 years ago
Write a recursive function using pseudocode or C/C++.
Anarel [89]

Answer:

long fact(int n)

{

   if(n<=1)//base case

   return 1;  

   long p=fact(n-1);//recursive call.

   return n*p;//returning the factorial.

}

Explanation:

Above written function is written in C++ language.It is a recursive function to find the factorial of the function.

If we enter a number  equal to  or  less than  1  then the function returns 1. Then the recursive call  is made  and it is stored  in the long  variable  p and  the result is returned as n*p.

5 0
4 years ago
the set of methods that can be used to acquire, organize, store, manipulate, and transmit information is known as .
Nina [5.8K]

Information technology is the umbrella term for a collection of processes that can be used to collect, arrange, organize, store, alter, and transfer data.

Technology: What Is It?

Technology is the systematic and repeatable body of scientific to achieve practical objectives. The result of such an effort is sometimes known as technology. The use of tech is pervasive in many areas, including daily life, science, industry, communication, and transportation. Both real things like the machines or the utensils and intangible tools like software are considered technologies. Computer technology (IT) is indeed the practice of creating, processing, storing, retrieving, and exchanging various types of data and information using computers. Technology used for information and communications includes IT.

To know more about Technology
brainly.com/question/7788080
#SPJ4

3 0
1 year ago
Each of the flowchart segments in Figure 3-24 is unstructured. Redraw each segment so that it does the same processes under the
SSSSS [86.1K]

The segments of the flowcharts have been recreated such that  it does the same processes under the same conditions, but is structured. Their respective pseudo codes have also been created. See the attached pdf.

<h3>What is a pseudo code?</h3>

A pseudo code is a notation used in program design that looks like a simplified computer language.

<h3>Why is it important for flow chart to be structured?</h3>

This preference derives from the fact that such flowcharts are easier to understand and produce less mistakes in human perception.

The organized flowchart primarily aids the mission in the development of new algorithms by encapsulating a variety of data points within an interconnected depiction.

Learn more about flowcharts at;
brainly.com/question/6532130
#SPJ1

5 0
2 years ago
Other questions:
  • The malicious use of computer code to modify the normal operations of a computer or network is called a ___ .
    13·1 answer
  • What are some types of vehicle technology advancements?
    5·1 answer
  • VURULU<br> The default style in Word is called the
    6·1 answer
  • What are different types of inner classes ?
    8·1 answer
  • describe at least five ways in which information technology can help studying subjects other than computing​
    6·1 answer
  • The Fourth Amendment does not allow police to randomly test people for drunk driving. True or False
    14·1 answer
  • Define stubs for the functions get_user_num() and compute_avg(). Each stub should print "FIXME: Finish function_name()" followed
    8·1 answer
  • True or False: VLANs in cloud computing are most likely to be found on direct connections with a CSP.
    9·1 answer
  • Consider a student club or organization in which you are a
    14·1 answer
  • Selling emojis that you dont have
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!