> So this call will always try to round None(the default return value)
> And of course it produces no output since it prints nothing.
>
> Are you sure that's actually what is in the book?
No. That's very much why I wanted a reference to the original source
of the problem.
Scott attributed too m
On 01/04/14 02:07, Scott W Dunning 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
Scott W Dunning Wrote in message:
> 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
>
On 01/04/2014 02:47, Danny Yoo wrote:
On Mar 31, 2014 6:22 PM, "Scott W Dunning" mailto: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):
>
On Mar 31, 2014, at 7:10 PM, Danny Yoo wrote:
Thanks for the info Danny! I’ll try that and I should be able to figure it out
with your help!
The book I was referring to is greentreepress.
___
Tutor maillist - Tutor@python.org
To unsubscribe or c
On Mon, Mar 31, 2014 at 8:48 PM, Scott W Dunning wrote:
>
> On Mar 31, 2014, at 7:10 PM, Danny Yoo wrote:
> Thanks for the info Danny! I’ll try that and I should be able to figure it
> out with your help!
>
> The book I was referring to is greentreepress.
The reason I'm asking is I want to do
> I tweaked it to what I thought was correct but when I test it I get nothing
> back.
>
> def square_root(a, eps=1e-6):
>x = a/2.0
>while True:
>y = (x + a/x)/2.0
>if abs(x - y) < eps:
>return y
>x = y
>
> round(square_root(9))
>
> The way I tweaked it s
Also, which book?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On Mar 31, 2014 6:22 PM, "Scott W Dunning" 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 +
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:
10 matches
Mail list logo