[Tutor] How do I create a "loop until" looping structure?

1 2 bothenta at gmail.com
Wed May 21 12:32:34 CEST 2014


Hi there,
  As shown in the codes below, I want to end the loop until the s is no
greater than -5 but I found there is no "do... loop until..." like C so
what should I do? I will write it in C's style

s,n = 0,1
do:
    import math
    s=s+(math.log((n+1)/(n+2))/math.log(2))
loop until s < -5
print(s)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140521/e518ee71/attachment.html>


More information about the Tutor mailing list