newbie question: for loop within for loop confusion
lawtonpaul at gmail.com
Tue Jun 17 02:48:17 CEST 2008
Thank you for the informative reply.
Yes, I created the indent problem when manually copying the original
script when I posted. (I'm using an old laptop to study python and
posting here using the desktop.)
Your examples really helped. Last night I played with using a for
loop instead of a while loop and got it working, but your examples
really clarified things.
This loop was particularly interesting because I didn't know the else
could be attached to the for. Attaching it to the for solved a lot of
for letter in avoid:
if letter in word:
I've printed out this whole thread and will be playing with your and
I love this one for its conciseness, but will have to play with it to
get my head around it.
if not any(letter in word for letter in avoid):
More information about the Python-list