[Tutor] Fw: :initialize a for loop

ALAN GAULD alan.gauld at btinternet.com
Fri Jan 2 22:55:30 CET 2009

Forwarding to list...

----- Forwarded Message ----

yes i want to clear the images before the next iteration,here is the pseudo code what i want to do

a = [ ]
for i in range(self.numOne)
 to create an empty array, and append the index i to the array and pass this index to gtk image,how i can do this in for-in statement

0 for i in range (self.numOne)
self.numOne = random.randint(1,10)
  for i in range(self.numOne):
       self.image = gtk.Image()
       self.fixed.put(self.image, i*25, 0)


On Fri, Jan 2, 2009 at 9:45 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:

"i i" <iaidas4 at gmail.com> wrote in

  self.numOne = random.randint(1,10)
  for i in range(self.numOne):
       self.image = gtk.Image()
       self.fixed.put(self.image, i*25, 0)

images,i want to initialize the array or empty it before the next loop.
how can we initialize or empty a for-in statement in python.

I don't understand the question? What is it you want to initialise
or empty?

Do you just want to break out of the loop?
Do you want to clear the images you have already created
at some point?

Can you show us some pseudo code that would illustrate
how you would like the program to work?

Alan Gauld
Author of the Learn to Program web site

Tutor maillist  -  Tutor at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090102/29c89064/attachment.htm>

More information about the Tutor mailing list