This could be an interesting error

Michael Torrie torriem at gmail.com
Mon Sep 1 00:15:58 EDT 2014


On 08/31/2014 06:04 PM, Seymore4Head wrote:
>>    for x,letter in enumerate(word):
>>        # x is index (position), letter is the value at that index
>>        if letter in "AEIOUaeiou":
> I tried changing:
> for x in range(len(test)):
> to
> for x in enumerate(test):

Read my example again. You missed something vital.  enumerate returns
both a position and the item:

for x,letter in "hello":
    print (x, " ", letter)






More information about the Python-list mailing list