Okay, so I made it to FOR loops in the Lutz book. A couple of days ago I was
helped here with the .join method for creating strings from lists or tuples of
strings. I got to wondering if I could just, for the sake of learning, do the
same thing in a FOR loop, since that's today's chapter:
x=0; ham=''; b=['s','p','a','m'] #or, b=('s','p','a','m')
for t in b:
ham=ham+b[x]
print(ham);x+=1
s
sp
spa
spam
Alright, it works, eventually. Can someone help me find a little more elegant
way of doing this? I'm sure there are several.
Incidentally, I put the print statement within the FOR loop so I could watch
progress.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor