Hello,

one beginner question:

aList = [0, 1, 2, 3, 4]
bList = [2*i for i in aList]
sum = 0
for j in bList:
        sum = sum + bList[j]
   print j

0
2
4
IndexError: 'list index out of range'
Why is j in the second run 2 and not 1 in the for-loop?? I think j is a control variable with 0, 1, 2, 3, ...

Thanks!

Karl
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to