D
DeepBleu
I noticed the following:a 0
b 1
b 1
a 0
(expected result:
a 0
b 1
b 2
a 3)
The same with lists:
0 1
1 0
(expected result:
1 0
0 1
1 2)
What is going on? Can someone clarify this to me? And how can I ensure
that the iteration produces the absolute index number **without** doing
something like:
b 1
b 2
a 3
Thanks -
b 1
b 1
a 0
(expected result:
a 0
b 1
b 2
a 3)
The same with lists:
1 0List = [1, 0 , 1]
for n in List:
print n, List.index(n)
0 1
1 0
(expected result:
1 0
0 1
1 2)
What is going on? Can someone clarify this to me? And how can I ensure
that the iteration produces the absolute index number **without** doing
something like:
a 0a = 'abba'
k = len(a)
for m in range(0, k):
print a[m], m
b 1
b 2
a 3
Thanks -