[Tutor] loop question
Kyle Babich
kb@mm.st
Mon, 12 Aug 2002 19:13:27 UT
Is there any way I could get a for loop to remember what it did in the
previous action of the loop?
(I don't need to know this for a program or anything, I'm just asking.)
For example I put all of the characters from the "Black holes are where
God divided by zero" saying into a dictionary, but split the characters
like ... "char1char3char5" ... "char2char4char6" and I am trying to
make a for loop print them back out so it forms the sentence. The
thing is the for loop won't remember the i =3D i + 1 from it's previous
action.
####################
sigs=3D{"sig11":"bakoeaeweeodvddyeo","sig12":"lchlsrhrgdiiebzr"}
i =3D 0
for i in sigs:
i =3D int(i)
print sigs["sig11"][i] + sigs["sig12"][i]
i =3D i + 1
####################
I know the problem is my loop and the i, I just don't know why it is a
problem or how to fix it.
Thank you,
--
Kyle