Hello, I need to write a program that implements Newton's method ((guess + x/guess) / (2)). The program should prompt the user for the value to find the squareroot of (x) and the number of times to improve the guess. Starting with a guess value of x/2, your program should loop the specified number of times applying newton's method and report the final value of guess. You should also subtract your estimate from the value of math.sqrt() to show how close it is.
So far.. I got: Help with Code Tags<http://www.daniweb.com/forums/misc-explaincode.html?TB_iframe=true&height=400&width=680> (Toggle Plain Text <http://www.daniweb.com/forums/post787759.html#>) import math def main(): value, guess = input("Please enter the value, and the number of times to loop: ") for i in range(guess): top = guess + value / guess final_value = float(top) / 2 close = final_value - math.sqrt(x) close_two = math.sqrt(x) print "The guess is", final_value, "which is", close, "away from", close_two main() Could you please help me out? Thanks - Donna
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor