On Mar 31, 2014 6:22 PM, "Scott W Dunning" <scott....@cox.net> wrote:
>
> I’m working on a few exercises and I’m a little stuck on this one.
>
> This is what the book has but it just gives me an endless loop.
>
> def square_root(a, eps=1e-6):
>         while True:
>                 print x
>                 y = (x + a/x) / 2
>                 if abs(y-x) < epsilon:
>                         break
>
> round(square_root(9))

Hi Scott,

Ah.  I think I see what might be wrong, but let's make sure about this.

Can you explain what 'x', 'y' are in this function?
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to