[Tutor] How does it work?
Alan Gauld
alan.gauld at btinternet.com
Mon Jan 3 17:09:48 CET 2011
"Neo Vector" <neo_vector at yahoo.com> wrote
> Could you explain me how does it work, pls?
> ==============================
>>>>r = ''
r is an empty string
>>>>for c in 'abcd':
c takes the value of each letter in turn
> r = c + r
strings can be added such that the result is the
concatenation of the two strings. So in this case:
r becomes the sum of its old value and the current value of c
repeat for the next value of c.
If that doesn't help then tell us which bit(s) of it you
don't understand.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list