Re: [Tutor] newton's square root formula

2009-02-03 Thread Alan Gauld
"WM." wrote # program to find square root square = float(raw_input ("Please enter a number to be rooted, ")) guess = input("Please guess at the root, ") Actually, I meant you should use raw_input here too... input() is considered insecure and not recommended. (In Python v3 it has been remo

Re: [Tutor] newton's square root formula

2009-02-03 Thread Andre Engels
On Tue, Feb 3, 2009 at 3:59 AM, WM. wrote: > # program to find square root > square = float(raw_input ("Please enter a number to be rooted, ")) > guess = input("Please guess at the root, ") > i = 0 > while guess**2 != square: >i+=1 ># Newton's formula >guess = guess - (gues

[Tutor] newton's square root formula

2009-02-02 Thread WM.
# program to find square root square = float(raw_input ("Please enter a number to be rooted, ")) guess = input("Please guess at the root, ") i = 0 while guess**2 != square: i+=1 # Newton's formula guess = guess - (guess * guess - square) / (guess * 2) print i print