On Wed, 3 Sep 2014 11:19:04 -0700, Rob Gaddi <rgaddi@technologyhighland.invalid> wrote:
>On Wed, 03 Sep 2014 14:10:42 -0400 >Seymore4Head <Seymore4Head@Hotmail.invalid> wrote: > >> import math >> import random >> import sys >> b=[] >> steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] >> for x in steve: >> print (steve[x]) >> >> Traceback (most recent call last): >> File "C:\Functions\blank.py", line 7, in <module> >> print (steve[x]) >> IndexError: list index out of range > >You're failing to go through the basic tutorials, and blaming the >language when you don't understand things. > >'for x in steve' does not sweep x over the indices of steve. 'for x in >steve' sweeps x over the sequential _values_ in steve. This would have >been clear if you were to add a print(x) into the loop. Yes print(x) does make that clear Thanks -- https://mail.python.org/mailman/listinfo/python-list