Computers and Technology, 16.06.2021 22:10 ErickN7597
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 program should also include a main function that allows the user to compute the square roots of inputs from the user and python's estimate of its square roots until the enter/return key is pressed.
My code:
import math
tolerance = 0.00001
def newton(x):
estimate = 1.0
while True:
estimate = (estimate + x/estimate) /2
difference = abs(x - estimate**2)
if difference <= tolerance:
break
return estimate
def main():
while True:
x = input("Enter a positive number or enter/return to quit: ")
if x==" ":
break
x = float(x)
print("The program's estimate of the square root of",x,"is", round(newtown(x),2))
print("Python's estimate is:",math. sqrt(x))
main()
it keeps coming up with a syntax error --invalid syntax for line 23 except:
Answers: 3
Computers and Technology, 22.06.2019 11:00
You receive an email from an impressive-sounding stranger, professor alexander rothschild renard iii, president of the american institute for scientific political statesmen. he urges you to vote for his presidential candidate choice. this social media red flag is known as
Answers: 1
Computers and Technology, 22.06.2019 15:00
This is not a factor that you should use to determine the content of your presentation. your audience your goals your purpose your technology
Answers: 1
Computers and Technology, 22.06.2019 22:30
The qwerty keyboard is the most common layout of keys on a keyboard
Answers: 3
Computers and Technology, 23.06.2019 14:30
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
Package Newton’s method for approximating square roots (Case Study: Approximating Square Roots) in a...
English, 13.03.2021 02:40
Mathematics, 13.03.2021 02:40
Mathematics, 13.03.2021 02:40
Mathematics, 13.03.2021 02:40
Chemistry, 13.03.2021 02:40
Mathematics, 13.03.2021 02:40
Mathematics, 13.03.2021 02:40
English, 13.03.2021 02:40
Mathematics, 13.03.2021 02:40
Arts, 13.03.2021 02:40
English, 13.03.2021 02:40
Business, 13.03.2021 02:40