On Tue, Sep 8, 2009 at 10:48 AM, shellc...@juno.com <shellc...@juno.com>wrote:
> > I want to write a code that allows me to input a phrase and calculate the > number of vowels twice. once with the for loop and second with the while > loop.I can get the for loop to work but, not the while loop. this is my code > and response. > [snip] > index = 0 > while index < len(phrase): > if phrase[index] in VOWELS: > > index = index +1 > print "number of vowels" ,index > This is an infinite loop. When phrase[index] is not in VOWELS, nothing changes and the test "index < len(phrase)" is still true.
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor