variable assignment within a loop
Michael T. Babcock
mbabcock at fibrespeed.net
Wed Nov 5 08:42:36 EST 2003
paul at svensson.org wrote:
>take a deep breath, then repeat ten times:
>
>"I will test my examples before posting"
>
> /Paul
>
>
$ python2
Python 2.3 (#1, Sep 15 2003, 12:45:41)
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = ""
>>> for x in "abc":
... a = x
... print a
...
a
b
c
>>> print a
c
--
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock
More information about the Python-list
mailing list