加上 if ch 这段后 程序的输出2的平方根结果就是1.5.去掉后就是1.41.......。为什么啊?
while True:
low = 0
higth = float(raw_input("a:"))
guess = float((low + higth)/2)
x = higth
while guess**2 != x:
if guess**2 > x:
higth = guess
else:
low = guess
guess = (low +higth)/2
print guess
ch = str(raw_input("\'q\'is quit the program or any key to comtinue:"))
if ch == "q":
break