jonathan wallis wrote:

i cant figure out if there is a way to make so if one loop ends it says something different than if the other loop ends.

Maybe you could use two separate tests and break out of the loop if x or y gets too low. Because the tests are separated you could say something different for each case.
For example:

import random

x=y=9
while True:
    print "x is %d, y is %d" % (x,y)
    if x<=0:
        print "Loop stopped because X was too low"
        break
    if y<=0:
        print "Loop stopped because Y was too low"
        break
    # do something with x and y
    if random.random()>0.5:
        x-=1
    else:
        y-=1


--
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Valloppillil
http://www.catb.org/~esr/halloween/halloween4.html
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to