I am new to programming, and it was difficult for me to understand the logic associated with the Python looping example I came across:
s="abcdefg"
t=""
for a in s:
t=a+t
I am confused why this piece of code returns "gfedcba". Why should it be otherwise:
s="abcdefg"
t=""
for a in s:
t=t+a
... which returns "abcdefg".
source
share