"W W" <[EMAIL PROTECTED]> wrote

for x in xrange(3, 0, -1):
  ....:     print x
  ....:
  ....:
3
2
1

Since the OP isn't using the loop counter a simpler solution
is simply

for x in range(3):

i,j,k = 3,3,3
while i != 1:
   print 'Larry, Moe & Curly Joe!'
   i -= 1
   while j != 1:
       print 'Go Mad!!'
       j -= 1
while k != 1:
   print 'Go-go bad-bad!!'
   k -= 1
print '\nBye-bye.'

I am trying to learn loops. These nested 'whiles' work OK but I would like to wrap this script in a 'for' loop. I have not been able to make that work.

To the OP:
It helps if you show us what you tried so that we can see where
the misunderstanding is. What did you do and what happened?


--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to