I neglected to mention that we'd like you to always reply-all so a copy goes to the list. All of us participate and learn.

Donna Ibarra wrote:
The numbers that are outputted are not exactly correct as they should be for Newtons Method:

OK - thanks - now please give us a few sample numbers, the results you want and the results you get.


import math

def main():
x, loops = input("Please enter the value, and the number of times to loop: ") for i in range(loops):
        new_loops = float(loops + (x / loops)) / 2
        loops = new_loops
print "The guess is", loops, "which is", loops - math.sqrt(x),"away from", math.sqrt(x)


main()

^Do you have any suggestions as to what I should do?

--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to