Re: newbie question: for loop within for loop confusion
takayuki wrote:
takayuki,
Could you post the complete script.
thanks
david
--
Powered by Gentoo GNU/LINUX
takayuki wrote:
Paul,
>
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
problems.
>
for letter in avoid:
if letter in word:
break
else:
print word
>
>
I've printed out this whole thread and will be playing with your and
others' solutions.
>
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):
print word
>
Thanks again.
>
takayuki
--
>
>
>
>
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
problems.
>
for letter in avoid:
if letter in word:
break
else:
print word
>
>
I've printed out this whole thread and will be playing with your and
others' solutions.
>
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):
print word
>
Thanks again.
>
takayuki
--
>
>
>
Could you post the complete script.
thanks
david
--
Powered by Gentoo GNU/LINUX
Comment