Re: newbie question: for loop within for loop confusion

2008-06-16 Thread takayuki
On Jun 17, 6:34 am, Thomas Hill <[EMAIL PROTECTED]> wrote: > On Jun 15, 6:23 pm, takayuki <[EMAIL PROTECTED]> wrote: > > > def hasnolet(avoid): > > fin = open('animals.txt') > > for line in fin: > > word =

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread takayuki
t word Thanks again. takayuki -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: for loop within for loop confusion

2008-06-15 Thread takayuki
Thanks to everyone for the excellent advice. Roy: I did as you suggested and could see after staring at the output for awhile what was going on. The print statements really helped to put a little light on things. Yes, I agree that "learning to fish" is the best way. John: There were two "inchwo

Re: newbie: for loop within for loop question

2008-06-15 Thread takayuki
Dennis, thanks for your reply. unfortunately i accidentally posted only half of my question! the "real" post should be up now. my apologies. takayuki On Jun 16, 10:15 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 15 Jun 2008 17:18:54 -0700 (PDT), takayuki

newbie question: for loop within for loop confusion

2008-06-15 Thread takayuki
n avoid: if letter in word: break else: print word hasnolet('abcd') Why doesn't the function above work? It returns: dog dog dog fish fish fish fish horse horse horse horse inchworm inchworm thanks f

newbie: for loop within for loop question

2008-06-15 Thread takayuki
Hi everyone, I'm studying python via the excellent "how to think like a python programmer" book by Allen Downey. Noob question follows... I have a txt file (animals.txt) which contains the following text each on a separate line: aardvark, bat, cat, dog, elephant, fish, giraffe, horse, inchworm,